1.安装准备 ,查看是否有自带的MySql 库,如果先有卸载
先解压软件:MySQL-5.6.36-1.linux_glibc2.5.x86_64.rpm-bundle.tar
[root@mini1 ~]# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64
[root@mini1 ~]# rpm -ev mysql-libs-5.1.71-1.el6.x86_64 --nodeps
2.安装server和client的rpm包
rpm -ivh MySQL-client-5.6.36-1.linux_glibc2.5.x86_64.rpm rpm -ivh MySQL-server-5.6.36-1.linux_glibc2.5.x86_64.rpm
注意:如果此步骤出现错误,需要安装mysql依赖
[root@mini1~]# yum install numact1
[root@mini1~]# yum install libaio
[root@mini1~]# yum install perl
然后重新安装server和client的rpm包。如果出现如下图所示代表安装成功。
3.启动mysql服务
[[email protected] apps]# service mysql start
Starting MySQL.Logging to '/var/lib/mysql/mini1.err'.
SUCCESS!
4.修改MySQL的登陆密码。先找到mysql生成的随机密码,如下:
[[email protected] apps]# cat /root/.mysql_secret
# The random password set for the root user at Sun Jun 10 01:56:02 2018 (local time): Tus8WTWy41TDbLFZ
4.1登陆mysql,在Enter password出粘贴刚才的随机密码
[[email protected] apps]# mysql -uroot -p
Enter password:
表示登陆成功,设置密码
mysql> set password=password('root');
Query OK, 0 rows affected (0.00 sec)
设置密码成功。
部分参考https://blog.csdn.net/vampirehgg/article/details/70308256
https://blog.csdn.net/liu_yulong/article/details/50328447
如有疑问,请留言