參考鏈接:https://blog.csdn.net/xufengzhu/article/details/81112783
1、登錄Mysql
mysql -uroot -p123456 -h127.0.0.1 -P3308
2、添加新的用戶wincrash,密碼wincrash
允許外網(wǎng)IP訪問數(shù)據(jù)庫,本命令包含上面的命令料身,是所有的IP都可以訪問該數(shù)據(jù)庫
create user 'wincrash'@'%' identified by 'wincrash';
3、用戶創(chuàng)建完成后衩茸,刷新授權(quán)
flush privileges;
4芹血、創(chuàng)建數(shù)據(jù)庫:
CREATE DATABASE winlog;
5、將改用戶wincrash賦權(quán)給數(shù)據(jù)庫winlog楞慈,并刷新授權(quán)
grant all privileges on DB
.* to 'username'@'%' identified by 'password' with grant option;
例如:
grant all privileges on winlog
.* to 'wincrash'@'%' identified by 'wincrash' with grant option;
flush privileges;
6幔烛、退出 root 重新登錄,使用wincrash登錄檢查本地登錄是否正常囊蓝,輸入密碼后饿悬,正常登錄,并使用show databases命令查看數(shù)據(jù)庫賦權(quán)是否正常聚霜。