1,、關(guān)閉SElinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config (永久關(guān)閉)
reboot (重啟服務(wù)器)
setenforce 0 (臨時(shí)關(guān)閉無(wú)須重啟)
2,、下載MySQL mysql-5.7.28-1.el6.x86_64.rpm-bundle.tar
地址:https://cdn.//Downloads/MySQL-5.7/mysql-5.7.28-1.el6.x86_64.rpm-bundle.tar
3,、使用winscp filezilla等工具傳至服務(wù)器
4,、解壓
tar xf mysql-5.7.28-1.el6.x86_64.rpm-bundle.tar
5,、安裝MySQL-server MySQL-client MySQL-common MySQL-libs
yum localinstall mysql-community-server-5.7.27-1.el6.x86_64.rpm mysql-community-client-5.7.27-1.el6.x86_64.rpm mysql-community-libs-5.7.27-1.el6.x86_64.rpm mysql-community-common-5.7.27-1.el6.x86_64.rpm
6,、修改配置文件/etc/my.cnf
vi /etc/my.cnf
[mysqld]
datadir=/data/mysql #MySQL數(shù)據(jù)目錄
socket=/var/lib/mysql/mysql.sock # socket 存放目錄
symbolic-links=0
log-error=/var/log/mysqld.log #日志存放目錄
pid-file=/data/mysql/mysqld.pid #pid存放目錄
lower_case_table_names=1 #不區(qū)分大小寫
7,、啟動(dòng)并初始化MySQL
service mysqld start
8、查找密碼/var/log/mysqld.log
cat /var/log/mysqld.log | grep password
9,、進(jìn)入MySQL并修改密碼
[root@localhost]# mysql -uroot -p
Enter password:(查找到的密碼)
mysql> alter user 'root'@'localhost' identified by 'P@ssw0rd'; #修改密碼
|