I'm using mariaDB.
Basically everytime I start it, it tells me a mysqld process already exists.
Why do I have to run sudo apachectl start for mysql to work?
Shouldn't I only need 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!
And a related problem is that when I edit etc/my.cnf it doesn't do anything.
I just know I'm doing something wrong, but I can't see what.
edit:
After doing mysql.server stop, then ps aux, this is what I get:
`
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`And here's info from my err log:
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` 2 1 Answer
my.cnf changes are not reflecting as main restart script is not closing down old mysql instance for some reason. ( corrupt data, bad configuration, missing file path pid, wrong permissions, mysql started with other script). Depending what kind of machine is that and what kind of data you are serving you could try manually kill processes for mysql and start it again from a script. But I see some error messages that show up when database integrity is bit lost (this should be fixed ) - and after restarting system you might end up in the same situation as you start or with data loss.
I would do steps more a like:
- take a backup of database (tables)
mysqldump database > database.sql - make binary backup of whole mysql folder (if possible )
- upgrade mysql to the latest format as error log indicates there might be a format problem
mysql_upgrade - check problems on tables
mysqlcheck -u root -p --auto-repair --check --all-databases - check disk/system health
- try to stop database server again (after fixes) if it fails:
- check error log again if no errors:
- kill process
kill -9 processnumberherefromps -auxcolumn 2 - check
ps -auxif server is still listed if not, start it and check error log again - check if pid file exist
ls -l /usr/local/var/mysql/( if no process , remove this file manually ) - reboot system if possible - sometimes it helps.... but also could make server down too.
hope it helps a bit.
2