mysql权限表整理
1、用set password命令mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
Query OK, 0 rows affected (0.00 sec)2、用mysqladmin# mysqladmin -uroot -p123456 password 1234abcd
备注:
格式:mysqladmin -u用户名 -p旧密码 password 新密码3、用update直接编辑user表
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> update user set PASSWORD = PASSWORD('1234abcd') where user = 'root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1Changed: 1Warnings: 0mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)4、在丢失root密码的时候:# mysqld_safe --skip-grant-tables & 15953# 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# mysql -u root
Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection id is 2Server version: 5.5.22 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> \s--------------mysqlVer 14.14 Distrib 5.5.22, for Linux (i686) usingEditLine wrapper
Connection id: 2Current database:
Current user: root@
SSL: Not in useCurrent pager: stdout
Using outfile: ''Using delimiter: ;
Server version: 5.5.22 Source distribution
Protocol version: 10Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn.characterset: utf8
UNIX socket: /tmp/mysql.sock
Uptime: 36 sec
Threads: 1Questions: 5Slow queries: 0Opens: 23Flush tables: 1Open tables: 18Queries per second avg: 0.138--------------mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> update user set password = PASSWORD('123456') where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1Changed: 1Warnings: 0mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
页:
[1]