method is a bit stupid, but, did not find a better way, so first loaded, see if friends have the need, record
CentOS installation MySQL5.7 When there are various problems, all kinds of error, tried countless ways, today finally installed, hereby record.
(1) First, download awget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm安装最新的MySQL的yum源,并安装上去
(2) Since the Yum source is downloading the latest installation package, you can install the latest MySQL after downloading the Yum source, but if you do not have the latest installation package, the system will automatically download the latest version of the installation package, the speed is slow, so First download the latest version of the MySQL database installation package, and then, using the Yum source for installation, yum source download path http://dev.mysql.com/downloads/repo/yum/, this allows you to choose what you need, You can also use the above one to download directly
(3) Install, direct yum-y install mysql*.rpm can
(4) Installation after the start of the general error, there is/var/run/mysqld/mysqld.pid ended such an error, here, 5.7 after the installation of MySQL need to do their own initialization of the data, You specify the initialization of the Basedir and DataDir respectively refers to the base path and data path, here, you need to remember the data path, will need to set this data path to our my.conf file,
The statements to initialize are:
#mkdir/opt/mysql/mysql
#mkdir/opt/mysql/mysql/data
#chown-R Mysql:mysql/opt/mysql
--datadir=/opt/mysql/mysql/data
The path here can be set by itself, if you start without these paths, you need to create the path, and the path to the MySQL user, because after the installation of MySQL automatically create such a user, so that after running, we can proceed to the next
(5) We start MySQL, the first time you start, no password,
You can use the command
Service Mysqld Start Services
(6) Client connection
Command
Mysql-u root-p to connect
(7) connection
When you connect, you need to be aware that when the MySQL5.7 is installed, a random password is produced in the root directory at the first boot, and the file name is. Mysql_secret, which is in the ~ directory, using the command
CD ~
Cat. Mysql_secret
The file is a hidden file, the path records the password, use the password here to log in successfully, modify the user password
SET PASSWORD = PASSWORD (' 123456 ');
Modify all hosts using the account can log in,
Use MySQL
Update user set host= '% ' where host= ' localhost ' and user= ' root ';
FLUSH privileges;
Restart the MySQL server to
Direct use of service mysqld restart (start, stop)
If there is a problem in the middle, you can use Mysqld_safe--skip-grant-tables& to skip the verification, the data inside the changes, but now it seems that the password can not be changed
Summarize:
The key point in this article is that the second half, the first half of the paragraph should be able to know how to install, but the first half is that if you do not upgrade the Yum source, directly installed, there will be a glibc version of the wrong, there will be some other strange errors, so that the bypass those errors, directly can, The second half of the beginning of the time is not too clear, the official website looked at the study for a long time also did not see too, today finally will mysql5.7 normal installation of a once, also calculate their own a harvest bar, in this record, hope can give you some enlightenment.
Install MySQL under CentOS6.5