参考链接:https://blog.csdn.net/xufengzhu/article/details/81112783
1、登录Mysql
mysql -uroot -p123456 -h127.0.0.1 -P3308
2、添加新的用户wincrash,密码wincrash
允许外网IP访问数据库,本命令包含上面的命令,是所有的IP都可以访问该数据库
create user 'wincrash'@'%' identified by 'wincrash';
3、用户创建完成后,刷新授权
flush privileges;
4、创建数据库:
CREATE DATABASE winlog;
5、将改用户wincrash赋权给数据库winlog,并刷新授权
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命令查看数据库赋权是否正常。
网友评论