Linux下MySQL5.7安裝教程
1.下載MySQL安裝包
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
2.安裝MySQL
sudo rpm -ivh mysql57-community-release-el7-11.noarch.rpm sudo yum install mysql-community-server
3.啟動(dòng)MySQL服務(wù)
sudo systemctl start mysqld
4.修改MySQL默認(rèn)密碼
sudo grep 'temporary password' /var/log/mysqld.log mysql -uroot -p(此處輸入初始密碼) ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
5.關(guān)閉MySQL服務(wù)
sudo systemctl stop mysqld
6.配置MySQL
sudo vim /etc/my.cnf 在[mysqld]下添加: lower_case_table_names=1 character_set_server=utf8 init_connect='SET NAMES utf8' datadir=/data/mysql socket=/var/lib/mysql/mysql.sock 編寫完成后保存退出
7.啟動(dòng)MySQL服務(wù)并測(cè)試
sudo systemctl start mysqld mysql -uroot -p(此處輸入新密碼) show variables like 'lower_case_table_names'; show variables like 'character_set_server';
安裝完畢后即可正常使用MySQL 5.7數(shù)據(jù)庫。