对不起我的英语不好;
我尝试在已为 MySQL 配置的 RoR 应用程序中使用 rake 创建数据库(已安装 gem,已更改设置)。
尝试之后,mysql-server 崩溃了:
d@calister:~$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
mysqld 根本没有运行:
d@calister:~$ ps aux | grep mysql
d 3769 0.0 0.0 4368 832 pts/0 S+ 18:03 0:00 grep --color=auto mysql
而且它似乎也不想运行:
d@calister:~$ sudo service mysql start
start: Job failed to start
有什么建议吗?
谢谢
编辑:
d@calister:~$ sudo -u mysql mysqld
120520 18:45:11 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
120520 18:45:11 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120520 18:45:11 InnoDB: The InnoDB memory heap is disabled
120520 18:45:11 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120520 18:45:11 InnoDB: Compressed tables use zlib 1.2.3.4
120520 18:45:11 InnoDB: Initializing buffer pool, size = 128.0M
120520 18:45:11 InnoDB: Completed initialization of buffer pool
120520 18:45:11 InnoDB: highest supported file format is Barracuda.
120520 18:45:12 InnoDB: Waiting for the background threads to start
120520 18:45:13 InnoDB: 1.1.8 started; log sequence number 1589459
120520 18:45:13 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
答案1
尝试此命令vi /etc/mysql/my.cnf
并检查你的 mysql 配置文件是否写得好,我的意思是确保没有端口冲突或拼写错误。
如果您不确定如何配置它,只需将其重置为默认值。
这是默认文件,仅供参考!!!
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
bind-address = 127.0.0.1
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
expire_logs_days = 10
max_binlog_size = 100M
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
[isamchk]
key_buffer = 16M
!includedir /etc/mysql/conf.d/