Installation of mysql on linux (yum source installation)
https://blog.csdn.net/huyangg/article/details/71308147
Installation of mysql on linux (binary installation)
Note: Install mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz on centos7
1) Download the installation package for mysql
Official website download
Baidu Cloud Download
2) Check maridb on centos7 and delete it
#Find the location of the mariadb installation package for rpm installation rpm -qa | grep mariadb ------------------------------- #Find the information displayed rpm -qa | grep mariadb ------------------------------- #Unload the upper bag yum -y remove mariadb-libs-5.5.56-2.el7.x86_64
3) Upload and decompression of installation package
#Create tools and source folders under / home / weiweiwei, install software in front, upload files in the back cd /home/weiwei mkdir ./tools ./source #Enter the directory of the upload folder cd source rz Click Upload File #If you click rz without a pop-up box to prove that lrzsz is not installed, install it with the following command yum -y install lrzsz #After the upload is complete, unzip the file tar -zxvf #Create a folder to install mysql in tools cd ../tools mkdir mysql-5.6.39 #Copy the unzipped file below the folder cp -r /home/weiwei/source/mysql-5.6.39-linux-glibc2.12-x86_64 /home/weiwei/tools/mysql-5.6.39
4) Adding User Portfolio Users
#Execute the following commands to create mysql user groups groupadd mysql #Execute the following commands to create a user named mysql and join the mysql user group useradd -g mysql mysql
5) configure mysql configuration file in etc, which has parameters of mysql configuration. There are five files of mysql configuration parameter file with the same name.
Route | Explain |
/etc/my.cnf | |
basedir/my.cnf | |
datadir/my.cnf | |
--defaults-extra-file | # After reading the global configuration file, read the parameter file specified by extra before reading the user profile (~/.my.cnf) |
~/.my.cnf | The hidden file under the home directory, the point before my.cnf, indicates that my.cnf is a hidden file. |
Note: Assuming that all four profiles exist and the parameter file is specified with -- defaults-extra-file, if a "parameter variable" appears in all five profiles, then the parameter variable values in the subsequent configuration file will override the parameter variable values in the previous configuration file, that is to say, the values set in ~/.my.cnf will be used. |
Create the file my.cnf under / etc or copy the support-files/my-default.cnf under mysql file directly with the name
#Copy the reference file provided by mysql and change the name cp /home/weiwei/tools/mysql-5.6.39/support-files/my-default.cnf /etc/my.cnf #Modify past configuration files vim /etc/my.cnf
[mysql] # Setting the default character set for mysql client default-character-set=utf8 socket=/var/lib/mysql/mysql.sock [mysqld] skip-name-resolve #Setting up port 3306 port = 3306 socket=/var/lib/mysql/mysql.sock # Set up the installation directory of mysql basedir=/home/weiwei/tools/mysql-5.6.39 # Setting up the storage directory of data in mysql database datadir=/home/weiwei/tools/mysql-5.6.39/data # Permissible maximum number of connections max_connections=200 # The character set used by the server defaults to the latin1 character set of 8 bits encoding character-set-server=utf8 # Default storage engine to be used when creating new tables default-storage-engine=INNODB lower_case_table_name=1 max_allowed_packet=16M
6) installation
Error 1: Lack of packages
./scripts/mysql_install_db --user=mysql --basedir=/home/weiwei/tools/mysql-5.6.39/ --datadir=/home/weiwei/tools/mysql-5.6.39/data/ --------------------------------------------------------------------------- FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db: Data::Dumper ---------------------------------------------------------------------------
Solution: Install appropriate packages
yum -y install autoconf
Error two:
./scripts/mysql_install_db --user=mysql --basedir=/home/weiwei/tools/mysql-5.6.39/ --datadir=/home/weiwei/tools/mysql-5.6.39/data/ ------------------------------------------------------------------------ Installing MySQL system tables...2018-07-22 16:48:22 0 [Warning] Using unique option prefix lower_case_table_name instead of lower_case_table_names is deprecated and will be removed in a future release. Please use the full name instead. 2018-07-22 16:48:22 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-07-22 16:48:22 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2018-07-22 16:48:22 0 [Note] /home/weiwei/tools/mysql-5.6.39//bin/mysqld (mysqld 5.6.39) starting as process 10599 ... 2018-07-22 16:48:22 10599 [Note] InnoDB: Using atomics to ref count buffer pool pages 2018-07-22 16:48:22 10599 [Note] InnoDB: The InnoDB memory heap is disabled 2018-07-22 16:48:22 10599 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2018-07-22 16:48:22 10599 [Note] InnoDB: Memory barrier is not used 2018-07-22 16:48:22 10599 [Note] InnoDB: Compressed tables use zlib 1.2.3 2018-07-22 16:48:22 10599 [Note] InnoDB: Using Linux native AIO 2018-07-22 16:48:22 10599 [Note] InnoDB: Using CPU crc32 instructions 2018-07-22 16:48:22 10599 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2018-07-22 16:48:22 10599 [Note] InnoDB: Completed initialization of buffer pool 2018-07-22 16:48:22 10599 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2018-07-22 16:48:22 10599 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2018-07-22 16:48:22 10599 [Note] InnoDB: Database physically writes the file full: wait... 2018-07-22 16:48:22 10599 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2018-07-22 16:48:23 10599 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2018-07-22 16:48:23 10599 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2018-07-22 16:48:23 10599 [Warning] InnoDB: New log files created, LSN=45781 2018-07-22 16:48:23 10599 [Note] InnoDB: Doublewrite buffer not found: creating new 2018-07-22 16:48:23 10599 [Note] InnoDB: Doublewrite buffer created 2018-07-22 16:48:23 10599 [Note] InnoDB: 128 rollback segment(s) are active. 2018-07-22 16:48:23 10599 [Warning] InnoDB: Creating foreign key constraint system tables. 2018-07-22 16:48:23 10599 [Note] InnoDB: Foreign key constraint system tables created 2018-07-22 16:48:23 10599 [Note] InnoDB: Creating tablespace and datafile system tables. 2018-07-22 16:48:23 10599 [Note] InnoDB: Tablespace and datafile system tables created. 2018-07-22 16:48:23 10599 [Note] InnoDB: Waiting for purge to start 2018-07-22 16:48:23 10599 [Note] InnoDB: 5.6.39 started; log sequence number 0 ERROR: 1 Can't create/write to file '/home/weiwei/tools/mysql-5.6.39/data/mysql/db.MYI' (Errcode: 13 - Permission denied) 2018-07-22 16:48:23 10599 [ERROR] Aborting 2018-07-22 16:48:23 10599 [Note] Binlog end 2018-07-22 16:48:23 10599 [Note] InnoDB: FTS optimize thread exiting. 2018-07-22 16:48:23 10599 [Note] InnoDB: Starting shutdown... 2018-07-22 16:48:25 10599 [Note] InnoDB: Shutdown completed; log sequence number 1600607 2018-07-22 16:48:25 10599 [Note] /home/weiwei/tools/mysql-5.6.39//bin/mysqld: Shutdown complete ------------------------------------------------------------------------
mysqld system service configuration
3. Installation of mysql on linux (source code compilation and installation)