阿里雲伺服器(ubuntu)安裝MySQL及配置
阿新 • • 發佈:2018-12-10
1、root許可權安裝MySQL
sudo apt-get install mysql-server
安裝過程會讓你輸入root的密碼
2、登入MySQL並更改使用者授權
登入:mysql -u root -p
輸入root密碼後,進入MySQL
use mysql
update user set host='%' where user='root';
grant all privileges on *.* TO 'root'@'%' identified by 'root帳號的密碼' WITH GRANT OPTION;
FLUSH PRIVILEGES;
3、修改本地訪問的3306
vi /etc/mysql/mysql.conf.d/mysqld.cnf
註釋掉bindaddress=127.0.0.1
:wq
4、重啟MySQL
service mysql restart
5、雲伺服器配置安全組
雲伺服器ECS->網路和安全->安全組->配置規則,新增安全組規則,協議選擇MySQL3306,優先順序100,授權物件0.0.0.0/0,點選確定後,可以看到列表中新增了一條3306的規則
6、客戶端連線測試成功。