1. MySQL 安裝:
sudo apt-get install mysql-server
apt install mysql-client
apt install libmysqlclient-dev
期間會(huì)彈出設(shè)置root賬戶(hù)的密碼框,輸入兩次相同密碼。
2.驗(yàn)證是否安裝成功:
sudo netstat -tap | grep mysql
3.開(kāi)啟遠(yuǎn)程訪問(wèn)MySQL:
1)編輯mysql配置文件贰盗,注釋掉“bind-address = 127.0.0.1”:
vi /etc/mysql/mysql.conf.d/mysqld.cnf
#bind-address = 127.0.0.1
2)進(jìn)入 mysql root 賬戶(hù):
mysql -u root -p123456
此處的123456為第一步中設(shè)置的root帳戶(hù)密碼蔼水,根據(jù)自己的設(shè)置輸入對(duì)應(yīng)密碼荒给。
grant all on *.* to wyd@'%' identified by 'wcg2017';
刷新flush privileges;然后重啟mysql沙峻,通過(guò)/etc/init.d/mysql restart命令
flush privileges;
?/etc/init.d/mysql restart
以上參考:http://blog.csdn.net/yancey_blog/article/details/52780357