为自己创建的mysql数据库,添加新用户

来源:互联网 发布:罗马里奥进球数据 编辑:程序博客网 时间:2024/06/05 03:56

mysql -u root -p -A -S /home/mysqldata/data/mysql.sock --port=51680


输入密码后


CREATE DATABASE XXXX


创建用户并分配权限:


grant all privileges on 数据库名称.* to 用户名@localhost identified by '密码'  WITH GRANT OPTION;
grant all privileges on 数据库名称.* to 用户名@'需要连接的机器' identified by '密码' WITH GRANT OPTION;
grant all privileges on 数据库名称.* to 用户名@'需要连接的机器' identified by '密码' WITH GRANT OPTION;
grant all privileges on 数据库名称.* to 用户名@'需要连接的机器' identified by '密码' WITH GRANT OPTION;
grant all privileges on 数据库名称.* to 用户名@'%' identified by '密码'  WITH GRANT OPTION;
flush privileges;

阅读全文
0 0
原创粉丝点击