您的位置:首页 > 数据库 > MySQL

Mac brew安装mysql之后无法启动mysql

2016-07-22 20:50 453 查看
使用Mac  brew装完mysql之后,连接mysql报错:

songdeMacBook-Pro:mysql song$ mysql -uroot -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
mysql可能没有启动,使用mysql.server启动:

songdeMacBook-Pro:mysql song$ mysql.server start
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/songdeMacBook-Pro.local.pid).
查看/usr/local/var/mysql/songdeMacBook-Pro.local.err* 发现

sudo cat songdeMacBook-Pro.local.err 
2016-07-22T12:33:03.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2016-07-22T12:33:03.297682Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-07-22T12:33:03.297880Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2016-07-22T12:33:03.297941Z 0 [Note] /usr/local/Cellar/mysql/5.7.13/bin/mysqld (mysqld 5.7.13) starting as process 8070 ...
2016-07-22T12:33:03.300001Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2016-07-22T12:33:03.302731Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-22T12:33:03.302760Z 0 [Note] InnoDB: Uses event mutexes
2016-07-22T12:33:03.302766Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-07-22T12:33:03.302771Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-07-22T12:33:03.303096Z 0 [Note] InnoDB: Number of pools: 1
2016-07-22T12:33:03.303226Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-07-22T12:33:03.304476Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-07-22T12:33:03.314504Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-07-22T12:33:03.327415Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2016-07-22T12:33:03.327501Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2016-07-22T12:33:03.327537Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2016-07-22T12:33:03.637134Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2016-07-22T12:33:03.637177Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-07-22T12:33:03.637189Z 0 [ERROR] Failed to initialize plugins.
2016-07-22T12:33:03.637196Z 0 [ERROR] Aborting

Google了一下,发现http://qiita.com/ota42y/items/0364d1da7cbf90df3dc4


解決方法

該当ファイルがある/usr/local/var/mysql/を確認したところ、

ほぼ全てのファイルの所有権が ログインユーザ:admin になっていたため、

sudo chown -R _mysql /usr/local/var/mysql
sudo chmod -R o+rwx /usr/local/var/mysql


ok,问题解决。。。

停止mysql

songdeMacBook-Pro:mysql song$ sudo brew services stop mysql
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: