一、mysql设置密码的几种方法
新安装的mysql数据库是没有密码的
[root@localhost ~]# mysql -u root -p
Enter password: ###此处为空,直接回车
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, 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>
设置方法:
1、在用root账号进入mysql后设置密码
mysql> set password=password('123456'); ###123456为密码
Query OK, 0 rows affected (0.00 sec)
mysql> set password=password(''); ###清除密码,现在为空
Query OK, 0 rows affecte