我正在使用mariaDB。
基本上每次我启动它,它告诉我一个mysqld进程已经存在。
为什么我必须运行sudo apachectl start
以使mysql工作?
我不应该只需要mysql.server start
吗?
mysql.server restart
Shutting down MySQL
.. SUCCESS!
Starting MySQL
.171102 15:59:35 mysqld_safe Logging to '/usr/local/var/mysql/****.err'.
171102 15:59:35 mysqld_safe A mysqld process already exists
SUCCESS!
一个相关的问题是,当我编辑etc/my.cnf
时,它没有做任何事情。
我只知道我做错了什么,但我看不清楚。
编辑:
做完mysql.server后,然后ps aux
,这就是我得到的:
`
drewson 9625 0.0 0.0 2466636 2756 s001 S+ 3:55pm 0:00.59 mysql -u root -p --max_allowed_packet=1073741824 -D hive
drewson 10235 0.0 0.0 2442020 1936 s000 S+ 4:36pm 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn mysql
drewson 10186 0.0 1.3 2969520 108876 ?? S 4:35pm 0:00.26 /usr/local/opt/mariadb/bin/mysqld --basedir=/usr/local/opt/mariadb --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/opt/mariadb/lib/plugin --log-error=/usr/local/var/mysql/drewson.err --pid-file=drewson.pid
drewson 10105 0.0 0.0 2444660 2376 ?? S 4:35pm 0:00.02 /bin/sh /usr/local/opt/mariadb/bin/mysqld_safe --datadir=/usr/local/var/mysql`
这是我的错误日志中的信息:
2017-11-02 16:35:05 140735735079872 [ERROR] mysql.user has no `Event_priv` column at position 29
2017-11-02 16:35:05 140735735079872 [ERROR] Incorrect definition of table mysql.event: expected column 'sql_mode' at position 14 to have type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH'), found type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_A
2017-11-02 16:35:05 140735735079872 [ERROR] mysqld: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
2017-11-02 16:35:05 140735735079872 [Note] Reading of all Master_info entries succeded
2017-11-02 16:35:05 140735735079872 [Note] Added new Master_info '' to hash table
2017-11-02 16:35:05 140735735079872 [Note] /usr/local/opt/mariadb/bin/mysqld: ready for connections.
Version: '10.2.10-MariaDB' socket: '/tmp/mysql.sock' port: 3306 Homebrew`
答案 0 :(得分:4)
我会做更多的步骤:
mysqldump database > database.sql
mysql_upgrade
mysqlcheck -u root -p --auto-repair --check --all-databases
kill -9 processnumberhere
第2列ps -aux
ps -aux
是否仍然列出服务器,启动它并再次检查错误日志ls -l /usr/local/var/mysql/
(如果没有进程,请手动删除此文件)希望它有所帮助。