我刚刚在Mac OS X上安装了MySQL。下一步是设置root用户密码,因此我下一步是这样做:
- 启动终端应用程序以访问Unix命令行。
在Unix提示符下,我执行了以下命令:
$ cd /usr/local/mysql/bin $ ./mysqladmin -u root password 'password'
但是,当我执行命令时
$ ./mysql -u root
,这就是答案:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 224
Server version: 5.5.13 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, 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>
我可以mysql
不用任何密码进入命令行!
为什么是这样?
UPDATE mysql.user SET authentication_string=PASSWORD('password') WHERE User='root';
代替。