我有以下情况试图为我的 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!