Update the installation process of MySQL 5.7 version under Linux centos 6.5 here:
Installation Environment:
Linux version: centost6.5
mysql version: 5.7.17
MySQL installation method: rpm installation
1: First, check the command, the MySQL information that comes with the system: rpm -qa|grep -i mysql
Check if it is installed, grep's -i option means ignore case when matching
[root@localhost soft]#rpm -qa|grep -i mysql
mysql-libs-5.1.71-1.el6.x86_64
MySQL-python-1.2.3-0.3.c1.1.el6.x86_64
mysql-5.1.71-1.el6.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
2: If there is built-in MySQL in the system, it needs to be uninstalled; uninstall command: rpm-e mysql-libs-5.1.71.el6.x86_64 --nodeps
After all uninstalls are completed, perform a new mysql installation.
3: Install the associated packages required by mysql5.7:
mysql-community-client-5.7.17-1.el6.x86_64.rpm
mysql-community-common-5.7.17-1.el6.x86_64.rpm
mysql-community-libs-5.7.17-1.el6.x86_64.rpm
mysql-community-server-5.7.17-1.el6.x86_64.rpm
4: Installation order, otherwise it will report dependency package error, installation command: rpm -ivh mysql-community-server-5.7.17-1.el6.x86_64.rpm
(1)mysql-community-common-5.7.17-1.el6.x86_64.rpm
(2)mysql-community-libs-5.7.17-1.el6.x86_64.rpm
(3)mysql-community-client-5.7.17-1.el6.x86_64.rpm
(4)mysql-community-server-5.7.17-1.el6.x86_64.rpm
5:启动mysql:首先要 以正常的方式启动服务,service mysqld start ,第一次启动会初始化,启动好之后再关闭服务,再以跨越权限的方式启动:mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
如果之前有MySQL服务启动,需要先关闭,不然会启动不了。启动好了之后,直接mysql命令,再输入use mysql 命令。最后需要改密码:update mysql.user set authentication_string=password('flow@123') where user='root';,在mysql 5.7版本中没有password属性,只有authentication_string属性。
改密码:
update mysql.user set authentication_string=password('=newpassword') where user='root';
flush privileges;
6:最后关掉,停止mysql_safe 服务, 以正常的MySQL命令 启动:service mysqld start ,然后 以MySQL -uroot -p 进入mysql
改好密码后第一次进入,会提示需要重新设定密码的。
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
重新设定密码:mysql> set password=password('Flow@123');
重新设定的密码跟第一次是不一样的,如果一样会提示不符合要求。
ps:安装完成之后,5.7版本不能以mysql直接进入,如果不改密码直接以mysql -uroot -p 方式进入,也不可以的(自己试过),通过网上查资料,5.7版本会生成一个随机密码:cat /root/.mysql_secret ,但是经本人亲自测试貌似不行。