美文网首页
MySQL常用命令

MySQL常用命令

作者: 踩着阳光 | 来源:发表于2020-04-27 20:42 被阅读0次

参考链接: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命令查看数据库赋权是否正常。

相关文章

网友评论

      本文标题:MySQL常用命令

      本文链接:https://www.haomeiwen.com/subject/ttzuwhtx.html