Mysql 5.6添加修改用户名和密码的方法
程序员文章站
2022-05-19 08:55:28
先登录mysql
shell> mysql --user=root mysql
有密码的需要添加 –password 或-p 选项
添加用户...
先登录mysql
shell> mysql --user=root mysql
有密码的需要添加 –password 或-p 选项
添加用户
mysql>create user 'finley'@'localhost' identified by 'some_pass'; mysql>grant all privileges on *.* to 'finley'@'localhost' with grant option; mysql>create user 'finley'@'%' identified by 'some_pass'; mysql>grant all privileges on *.* to 'finley'@'%' with grant option; mysql>create user 'admin'@'localhost' identified by 'admin_pass'; mysql>grant reload,process on *.* to 'admin'@'localhost'; mysql>create user 'dummy'@'localhost';
添加用户并设置数据库具体权限:
mysql>create user 'custom'@'localhost' identified by 'obscure'; mysql>grant select,insert,update,delete,create,drop on bankaccount.* to 'custom'@'localhost'; mysql>create user'custom'@'host47.example.com' identified by 'obscure'; mysql>grant select,insert,update,delete,create,drop on expenses.* to 'custom'@'host47.example.com'; mysql>create user 'custom'@'%.example.com' identified by 'obscure'; mysql>grant select,insert,update,delete,create,drop on customer.* to 'custom'@'%.example.com';
删除用户:
mysql>drop user 'jeffrey'@'localhost';
修改密码:
mysql>set password for 'jeffrey'@'localhost' = password('mypass');
修改当前登录用户密码:
mysql>set password = password('mypass');
以上所述是小编给大家介绍的mysql 5.6添加修改用户名和密码的方法,希望对大家有所帮助
上一篇: 详解MySQL分组排序求Top N
下一篇: javascript正则表达式简介
推荐阅读
-
修改mysql密码与忘记mysql密码的处理方法_MySQL
-
Mysql 5.6添加修改用户名和密码的方法
-
mysql root用户的密码修改和消除_MySQL
-
wamp下修改mysql访问密码的解决方法_PHP
-
apmserv中修改mysql的root与phpmyadmin密码方法介绍_PHP教程
-
php中存储用户ID和密码到mysql数据库的方法
-
Windows系统中MySQL 5.6的配置文件(my.ini)修改方法_MySQL
-
修改MYSQL密码的几种常用方法总结_MySQL
-
TortoiseGit 连接oschina不用每次输入用户名和密码的方法
-
windows下忘记MySQL密码的修改方法_MySQL