我刚刚在一台Linux机器上安装了mySQL 5.1.55,好像没问题
# /usr/local/mysql/bin/mysql_install_db
Installing MySQL system tables...
160606 21:46:25 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
Filling help tables...
160606 21:46:26 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql-5.1.55/bin/mysqladmin -u root password 'new-password'
Alternatively you can run:
/usr/local/mysql-5.1.55/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql-5.1.55 ; /usr/local/mysql-5.1.55/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql-5.1.55/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/local/mysql-5.1.55/bin/mysqlbug script!
但是,如果我运行
# /usr/local/mysql-5.1.55/bin/mysqladmin -u root password foo
我收到此错误消息:
/usr/local/mysql-5.1.55/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
如果我运行:
# /usr/local/mysql-5.1.55/bin/mysql -u root -p
我不知道密码是:-S
欢迎任何帮助。非常感谢。
最佳答案
如果没有运行就安装了mysql
> mysql_secure_installation
脚本根本不应该有密码。只需输入
> mysql
看看会发生什么。如果失败,您仍然可以在 mysql manual 之后设置一个新的 root 密码。
关于mySQL: "Access denied for user ' root' @'localhost"安装软件后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37665928/