您的位置:首页 > 数据库 > MySQL

MySQL学习笔记2-System administration(set password)

2015-11-17 15:51 816 查看
安装完毕后,第一次登录mysql,修改密码

[root@localhost bin]# service mysql start

Starting MySQL.. SUCCESS! 

[root@localhost bin]# cat /root/.mysql_secret

# The random password set for the root user at Tue Nov 17 21:33:33 2015 (local time): d08oVJ5RDL5c5YVP

[root@localhost bin]# mysql -pd08oVJ5RDL5c5YVP -uroot

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.6.27

Copyright (c) 2000, 2015, 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> set password for 'root'@'localhost' =password('');

Query OK, 0 rows affected (0.00 sec)

mysql> quit

Bye

[root@localhost bin]# mysql -p -uroot

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.6.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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> set password for 'root'@'localhost' =password('mysql');

Query OK, 0 rows affected (0.00 sec)

mysql> exit

Bye

[root@localhost bin]# 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: