博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MySQL之权限管理
阅读量:6792 次
发布时间:2019-06-26

本文共 2474 字,大约阅读时间需要 8 分钟。

  hot3.png

6、对账户重命名

mysql> rename user 'jack'@'%' to 'jim'@'%';Query OK, 0 rows affected (0.00 sec)

    7、修改密码

复制代码
1、用set password命令mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');Query OK, 0 rows affected (0.00 sec) 2、用mysqladmin [root@rhel5 ~]# mysqladmin -uroot -p123456 password 1234abcd  备注:  格式:mysqladmin -u用户名 -p旧密码 password 新密码 3、用update直接编辑user表  mysql> use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -A Database changedmysql> update user set PASSWORD = PASSWORD('1234abcd') where user = 'root';Query OK, 1 row affected (0.01 sec)Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges;Query OK, 0 rows affected (0.00 sec) 4、在丢失root密码的时候: [root@rhel5 ~]# mysqld_safe --skip-grant-tables & [1] 15953 [root@rhel5 ~]# 130911 09:35:33 mysqld_safe Logging to '/mysql/mysql5.5/data/rhel5.4.err'. 130911 09:35:33 mysqld_safe Starting mysqld daemon with databases from /mysql/mysql5.5/data [root@rhel5 ~]# mysql -u rootWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2 Server version: 5.5.22 Source distributionCopyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> \s -------------- mysql  Ver 14.14 Distrib 5.5.22, for Linux (i686) using  EditLine wrapperConnection id: 2 Current database: Current user:        root@SSL: Not in use Current pager:        stdoutUsing outfile: '' Using delimiter:    ;Server version: 5.5.22 Source distributionProtocol version: 10 Connection:        Localhost via UNIX socketServer characterset:    utf8Db     characterset:    utf8Client characterset:    utf8Conn.  characterset:    utf8UNIX socket: /tmp/mysql.sockUptime: 36 secThreads: 1 Questions: 5 Slow queries: 0 Opens: 23 Flush tables: 1 Open tables: 18 Queries per second avg: 0.138 --------------  mysql> use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -A Database changedmysql> update user set password = PASSWORD('123456') where user = 'root';Query OK, 1 row affected (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)

转载于:https://my.oschina.net/liting/blog/362297

你可能感兴趣的文章
Centos7安装cobbler2.6.9自动化部署工具
查看>>
【ZooKeeper Notes 4】可视化zookeeper的事务日志
查看>>
Java中的对象和垃圾回收
查看>>
Nginx 301重定向域名
查看>>
Eclipse的Copy Qualified Name
查看>>
ZooKeeper 的集群
查看>>
PHP学习笔记【24】--PHP超全局变量,$_GET,$_POST,$_SERVER
查看>>
深信服上网行为管理问题:下载到90%左右就会自动停止下载。
查看>>
linux(Centos)下完美部署Solr 搜索引擎
查看>>
Java-最近被使用缓存(LRU)
查看>>
Python3 处理 gb18030 乱码
查看>>
查看linux server网络I/0流量的shell脚本
查看>>
Oracle列变行的小例子
查看>>
Lwip IP包分片重组
查看>>
System Center 2012 R2实例1—构建自服务私有云8—SCSM服务
查看>>
微软Azure云之企业Exchange 2016部署1—项目介绍
查看>>
c语言:通过指针变量访问整型变量
查看>>
代理服务器的工作原理
查看>>
VIM insert模式下方向键失效的解决方式(超简单)
查看>>
调试版CRT函数的缓存填充字符问题
查看>>