多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 新增用户和重置密码 及 授权 [TOC] ****** >[info] #### 新增用户及授权 ~~~ mysql>select host,user,password from mysql.user; mysql>grant all on *.* to 用户名@"%" identified by "您的密码" mysql>flush privileges; 附:如果只授权某一数据库操作: mysql>grant all on `库名`.* to 用户名@"%" identified by "您的密码" ~~~ >[info] #### 修改密码 ~~~ mysql>use msyql; mysql>update user set password = password("密码") where user = "帐号"; mysql>flush privileges; ~~~ >[info] #### 删除用户 ~~~ mysql>delete from mysql.user where user ='您的用户名' ; mysql>flush privileges; (刷新系统权限表) ~~~ >[warning] #### 重置忘记的密码 * 应用于Linux ~~~ #vim /etc/my.cnf //在[mysqld]的段中加上一句:skip-grant-tables 例如: [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock skip-grant-tables 重新启动mysqld # /etc/init.d/mysqld restart # mysql -u root -p 回车进入 mysql>update user set password = password("密码") where user = "帐号"; mysql>flush privileges; ~~~