关闭

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

274人阅读 评论(0) 收藏 举报
分类:
安装完毕后,第一次登录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]# 
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:103592次
    • 积分:2300
    • 等级:
    • 排名:第16323名
    • 原创:64篇
    • 转载:23篇
    • 译文:64篇
    • 评论:3条
    最新评论