我在尝试为我的Rails 3项目启动MySQL时遇到了以下情况:
> mysql
> SHOW GRANTS for 'root'@'localhost'
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
> mysql -u root -p
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
> mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
> mysql -u root test
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
> mysqladmin --no-defaults -u root version
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
> mysqld_safe --skip-grant-tables
120611 05:27:06 mysqld_safe Logging to '/usr/local/mysql/data/SS-iMac.local.err'.
touch: /usr/local/mysql/data/SS-iMac.local.err: Permission denied
120611 05:27:06 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
/usr/local/mysql/bin/mysqld_safe: line 107: /usr/local/mysql/data/SS-iMac.local.err: Permission denied
rm: /tmp/mysql.sock: Permission denied
/usr/local/mysql/bin/mysqld_safe: line 144: /usr/local/mysql/data/SS-iMac.local.err: Permission denied
120611 05:27:06 mysqld_safe mysqld from pid file /usr/local/mysql/data/SS-iMac.local.pid ended
/usr/local/mysql/bin/mysqld_safe: line 107: /usr/local/mysql/data/SS-iMac.local.err: Permission denied
> sudo mysqld_safe --skip-grant-tables
120611 17:04:36 mysqld_safe Logging to '/usr/local/mysql-5.5.25-osx10.6-x86_64/data/SS-iMac.local.err'.
120611 17:04:36 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.5.25-osx10.6-x86_64/data
120611 17:06:16 mysqld_safe mysqld from pid file /usr/local/mysql-5.5.25-osx10.6-x86_64/data/SS-iMac.local.pid ended
我一直在阅读关于这个话题的每一个问答,但我总是遇到障碍。
SS-iMac.local.err目录
以下代码的副本每10秒添加一次。
120612 17:12:19 mysqld_safe mysqld from pid file /usr/local/var/mysql/SS-iMac.local.pid ended
120612 17:12:29 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
120612 17:12:29 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
120612 17:12:29 [Warning] One can only use the --user switch if running as root
120612 17:12:29 InnoDB: The InnoDB memory heap is disabled
120612 17:12:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120612 17:12:29 InnoDB: Compressed tables use zlib 1.2.3
120612 17:12:29 InnoDB: Initializing buffer pool, size = 128.0M
120612 17:12:29 InnoDB: Completed initialization of buffer pool
120612 17:12:29 InnoDB: highest supported file format is Barracuda.
120612 17:12:29 InnoDB: Waiting for the background threads to start
120612 17:12:30 InnoDB: 1.1.8 started; log sequence number 1595675
120612 17:12:30 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
120612 17:12:30 [Note] - '0.0.0.0' resolves to '0.0.0.0';
120612 17:12:30 [Note] Server socket created on IP: '0.0.0.0'.
120612 17:12:30 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
120612 17:12:30 [ERROR] Do you already have another mysqld server running on port: 3306 ?
120612 17:12:30 [ERROR] Aborting
> ps
PID TTY TIME CMD
3497 ttys001 0:00.03 -bash
3506 ttys002 0:00.03 -bash
> mysqladmin shutdown
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
最佳答案
sudo mysqld_safe—跳过授权表这终于可以工作了
关于mysql - MySQL 1045错误-存取被拒绝-非常固执,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10977621/