mysql 5.6提高了安全性,默认安装完之后,不允许空密码登录,而是在/root/.mysql_secret,记录了密码,所以首次登录,必须用这个文件里面的密码登录

[root@nagios ~]# cat .mysql_secret

# The random password set for the root user at Mon Oct 28 17:24:41 2013 (local time): Zirbdc2P

[root@nagios ~]# mysql -p

Enter password:

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

Your MySQL connection id is 4

Server version: 5.6.13

mysql> use mysql;

ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

mysql> set password=password(‘123456’);

Query OK, 0 rows affected (0.10 sec)

必须强制你修改密码,否则不让操作,必须用set password命令修改,修改后

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 -A

Database changed