linux安装mysql5.6.17

需要到mysq官网下载的包:

MySQL-5.6.17-1.linux_glibc2.5.i386.rpm-bundle.tar

解压后会有以下的六个包

MySQL-client-5.6.17-1.linux_glibc2.5.i386.rpm

MySQL-devel-5.6.17-1.linux_glibc2.5.i386.rpm

MySQL-embedded-5.6.17-1.linux_glibc2.5.i386.rpm

MySQL-server-5.6.17-1.linux_glibc2.5.i386.rpm 

MySQL-shared-5.6.17-1.linux_glibc2.5.i386.rpm

MySQL-shared-compat-5.6.17-1.linux_glibc2.5.i386.rpm

MySQL-test-5.6.17-1.linux_glibc2.5.i386.rpm

安装mysql数据库

[root@my66 ~]# rpm -e --nodeps mariadb-libs-1:5.5.56-2.el7.x86_64 (需要先卸载这个包)

[root@my66 ~]# yum -y install MySQL-client-5.6.17-1.linux_glibc2.5.i386.rpm  MySQL-devel-5.6.17-1.linux_glibc2.5.i386.rpm MySQL-embedded-5.6.17-1.linux_glibc2.5.i386.rpm MySQL-server-5.6.17-1.linux_glibc2.5.i386.rpm MySQL-shared-5.6.17-1.linux_glibc2.5.i386.rpm MySQL-shared-compat-5.6.17-1.linux_glibc2.5.i386.rpm  MySQL-test-5.6.17-1.linux_glibc2.5.i386.rpm

安装的过程中会现实以下的实现告诉我们怎么取找数据库的初始密码

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

  /usr/bin/mysql_secure_installation

[root@my66 ~]# cat /root/.mysql_secret | grep password   -----查数据库的初始密码
# The random password set for the root user at Fri Jul 27 19:58:59 2018 (local time): 8x9JVbAAccqBC4qN

[root@my66 ~]# systemctl restart mysql   ----开启服务
[root@my66 ~]# mysql -uroot -p'8x9JVbAAccqBC4qN'
mysql> update mysql.user
    -> set
    -> authentication_string=password("123456")
    -> where
    -> user="root" and host="localhost";
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

当改密的时候遇到这个错误的时候则运行以下代码,把数据库root的空密码都改成123456,则密码改成功了。

mysql> SET PASSWORD = PASSWORD('123456'); 

猜你喜欢

转载自blog.csdn.net/zhydream77/article/details/81253641