Long time not to move Linux, plus the previous use of this is less, so this installation, with the novice almost, summed up for beginners to reference:
1. Download the latest version of the MySQL community installation package from the Www.mysql.com website, and I'm down to mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz
2.mysql installation package is not./configure & make this set of things, you need to follow the instructions of the document to operate, here from the installation package see is install-binary, after the UE open
There is one section
shell> Groupadd MySQL
Shell> Useradd-r-G mysql-s/bin/false MySQL
Shell> cd/usr/local
Shell> Tar zxvf/path/to/mysql-version-os.tar.gz # Note Change the path to the location and name of the installation package you downloaded
shell> ln-s full-path-to-mysql-version-os MySQL # ibid., fill in the actual path name extracted
shell> CD MySQL
shell> mkdir Mysql-files
shell> chmod 770 Mysql-files
Shell> chown-r MySQL.
Shell> chgrp-r MySQL.
shell> bin/mysql_install_db--user=mysql # before MySQL 5.7.6
shell> bin/mysqld--initialize--user=mysql # MySQL 5.7.6 and up in the initialization, be sure to look at the screen carefully, and then there is probably a line 2015-12-24t09:0 5:03.283677z 1 [Note] A temporary password is generated for [email protected]: kklnbwkei1.t #注意这是root的临时密码 /c3>
shell> bin/mysql_ssl_rsa_setup # mysql 5.7.6 and up
Shell> chown-r Root.
shell> chown-r mysql Data mysql-files # The execution times are wrong, I'm just going to get rid of the data.
Shell> Bin/mysqld_safe--user=mysql &
# Next command is optional
shell> CP Support-files/mysql.server/etc/init.d/mysql.server # Note that the CP name here is Mysql.server, not mysqld, so start the service to use the services Mysql.server start, if the hope is mysqld, then the last sentence is written CP support-files/ Mysql.server/etc/init.d/mysqld, it's all right.
Follow the operation can be, but also relatively simple. But I made a mistake, copied the wrong line, has been initialized, and then found. Had to go to RM drop the MySQL directory under the/var/lib directory and start again
Start Service mysqld start (as mentioned in the previous step, some students may be service Mysql.server start) after logging in
For convenience, create a link file in the bin directory Ln-s/usr/local/mysql/bin/mysql/bin/mysql, of course, you can also add the path to the environment variables, such as: path= $PATH:/usr/local/mysql/ Bin
This error is always reported after logging in:
ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)
It seems that can not find the socket file, check it, if the file is damaged, as long as the restart service is good, this is the service started after the similar listening port configuration file
And then try Mysql-uroop-p.--socket=/var/lib/mysql/mysql.sock The password that was logged when the input was initialized
Login successful
Therefore, Ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
And then it's all done.
And one last step, change the root password.
Set password for ' root ' @ ' localhost ' = password (' WJZ ');
Add to the point that the above operations are done under root, when we exit to the normal account, it is possible to find the execution of the MySQL command still error Error 2002 (HY000): Can ' t connect to local MySQL server Through socket '/tmp/mysql.sock ' (2)
, this may be the problem of permissions, check the/tmp directory in the Mysql.sock file, and/var/lib/mysql directory, and so on, to change the permissions, the problem can be resolved.
Novice reference: Install the MySQL community version of the entire process on CentOS