Mysql 5.7.18 installation and configuration method graphic tutorial (CentOS7), 5.7.18centos7
How to install MySQL 5.7.18 in Linux
1. Download MySQL
Value.
2. Install the key steps and directly paste the command
[Cpp] view plain copy on CODE view CODE piece derived to my CODE piece [root @ CentOS MySQL] # tar-xzvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz-C/usr/local [root @ CentOS MySQL] # cd/usr/local [root @ CentOS local] # mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql [root @ CentOS local] # cd mysql [root @ CentOS mysql] # mkdir data [root @ CentOS mysql] # groupadd mysql [root @ CentOS mysql] # useradd-r-g mysql-s/bin/false mysql [root @ CentOS my SQL] # chown-R mysql: mysql. /[root @ CentOS mysql] # bin/mysqld -- initialize -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data 2017-02-23T07: 43: 03.404885Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. please use -- explicit_defaults_for_timestamp server option (see documentation for more details ). 2017-02-23T07: 43: 04.442174Z 0 [Warning] InnoDB: New log files Created, LSN = 45790 2017-02-23T07: 43: 04.588507Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2017-02-23T07: 43: 04.646721Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. generating a new UUID: b5c8e226-f99b-11e6-beb5-b7c1a1e39029. 2017-02-23T07: 43: 04.671492Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql. gtid_executed 'cannot be opened. 2017-02-23T07: 43: 04.672338Z 1 [Note] A temporary password is generated for root @ localhost: I % e = s + lfx9ko [root @ CentOS mysql] # bin/mysql_ssl_rsa_setup -- datadir =/usr/local/mysql/data Generating a 2048 bit RSA private key ..... ................................ ++ .............................. ++ writing new private key to 'Ca-key. pem' ----- Generating a 2 048 bit RSA private key ................................... ...... ++ ......................... ++ writing new private key to 'server-key. pem' ----- Generating a 2048 bit RSA private key .............................. .................... ++ ..................................... ........................................ ........................................ ........................................... ................................... ++ Writing new private key to 'client-key. pem' ----- [root @ CentOS mysql] # cd support-files [root @ CentOS support-files] # cp my-default.cnf/etc/my. cnf [root @ CentOS support-files] # gedit/etc/my. cnf [root @ CentOS support-files] # cp mysql. server/etc/init. d/mysqld [root @ CentOS support-files] # service mysqld start Starting MySQL. logging to '/usr/local/mysql/data/Cent OS .cn. err '... SUCCESS! [Root @ CentOS support-files] # ps aux | grep mysql root 18279 0.0 0.0 11764 1576 pts/0 S/bin/sh/usr/local/mysql/bin/mysqld_safe -- datadir =/usr/local/mysql/data -- pid-file =/usr/local/mysql/data/CentOS.cn. pid mysql 18449 1.9 9.5 1182688 177940 pts/0 Sl/usr/local/mysql/bin/mysqld -- basedir =/usr/local/mysql -- datadir =/usr/local/ mysql/data -- plugin-dir =/usr/local/mysql/lib/plugin -- user = mysql -- log-error =/usr/local/mysql/data/CentOS.cn. err -- pid-file =/usr/local/mysql/data/CentOS.cn. pid -- socket =/tmp/mysql. sock -- port = 3306 [root @ CentOS support-files] #
One line explanation:
Decompress the compressed package to the/usr/local directory to install MySQL in this directory.
Switch to/usr/local and rename the decompressed folder to mysql.
Create a data folder in the mysql directory to store MySQL data.
Add User Group mysql.
Add the username mysql to the mysql group.
Modify the owner and group of the mysql directory.
Initialize MySQL in two steps:
Step 1, Bin/mysqld pay attention to the following parameters. A temporary password will be generated in one part and saved. It will be used later when you log on to the database;
Step 2, Bin/mysql_ssl_rsa_setup, which looks like processing database security. Pay attention to the parameters later.
Switch to the support-files directory.
Copy the my-default.cnf to/etc/my. cnf, note that CentOS7 comes with a my. cnf file, overwrite it.
Edit the file, and modify only rows 18, 19, 20, and 22, as shown below:
Copy the mysql. server File to/etc/init. d/mysqld to start MySQL at startup.
Start the mysqld process.
Query the mysql process. There are two:/mysql/bin/mysqld_safe,/mysql/bin/mysqld
3. Subsequent Configuration:
Log on to mysql and change the temporary password:/usr/local/mysql/bin/mysql-u root-p. Press enter to enter the temporary password generated during initialization. Change the password:
Set password for 'root' @ localhost = password ('xxxxxx ');
Every time you log on to the mysql client, it is too difficult to enter an absolute path. You can create a soft connection: ln-s/usr/local/mysql/bin/mysql/usr/bin/mysql, this saves the trouble of configuring the PATH.
Start mysqld at startup and use the chkconfig command
Chkconfig -- add mysqld # add mysqld service chkconfig -- list # list all system services
Check whether all levels are open, for example:
Chkconfig -- level 35 mysqld on # Set mysqld to be running at startup in level 3 and 5
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.