MariaDB has worked fine but is now failing to run on boot up. I have uninstalled and it then reinstalled it and this does not fix anything.
Here is the output from mysql.server.start
mysql.server start
Starting MariaDB
.210913 10:08:11 mysqld_safe Logging to '/usr/local/var/mysql/xxxx-MacBookPro.local.err'.
210913 10:08:11 mysqld_safe Starting mariadbd daemon with databases from /usr/local/var/mysql
/usr/local/bin/mysql.server: line 264: kill: (4944) - No such process
ERROR!
This is what I get from brew info mariadb
mariadb: stable 10.6.4 (bottled)
Drop-in replacement for MySQL
https://mariadb.org/
Conflicts with:
mariadb-connector-c (because both install `mariadb_config`)
mysql (because mariadb, mysql, and percona install the same binaries)
mytop (because both install `mytop` binaries)
percona-server (because mariadb, mysql, and percona install the same binaries)
/usr/local/Cellar/mariadb/10.6.4 (902 files, 183MB) *
Poured from bottle on 2021-09-13 at 09:49:21
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/mariadb.rb
License: GPL-2.0-only
==> Dependencies
Build: bison ✘, cmake ✘, pkg-config ✘
Required: groonga ✔, openssl#1.1 ✔, pcre2 ✔
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
MySQL is configured to only allow connections from localhost by default
To have launchd start mariadb now and restart at login:
brew services start mariadb
Or, if you don't want/need a background service you can just run:
mysql.server start
==> Analytics
install: 13,312 (30 days), 41,010 (90 days), 166,455 (365 days)
install-on-request: 13,289 (30 days), 40,949 (90 days), 165,680 (365 days)
build-error: 0 (30 days)
Here is what I get from brew services list
dnsmasq stopped
httpd error xxxx /usr/local/opt/httpd/homebrew.mxcl.httpd.plist
mariadb xxxx /usr/local/opt/mariadb/homebrew.mxcl.mariadb.plist
mysql#5.7 xxxx /usr/local/opt/mysql#5.7/homebrew.mxcl.mysql#5.7.plist
nginx stopped
php#5.6 stopped
php#7.0 stopped
php#7.3 stopped
php#7.4 stopped
The mac is serving up PHP successfully which throws a "Connection Refused" error when the code tries to talk to the database. So, I don't really understand the httpd error if apache appears to be operating.
Here is the contents of the err log (thank you DanBlack)
This is from the /usr/local/var/mysql/xxxx-MacBookPro.local.err
2021-09-16T15:30:12.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/XXXX-MacBookPro.local.pid ended
210916 17:30:13 mysqld_safe Starting mariadbd daemon with databases from /usr/local/var/mysql
2021-09-16 17:30:13 0 [Note] /usr/local/opt/mariadb/bin/mariadbd (server 10.6.4-MariaDB) starting as process 33244 ...
2021-09-16 17:30:13 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
/usr/local/opt/mariadb/bin/mariadbd: Please consult the Knowledge Base to find out how to run mysqld as root!
2021-09-16 17:30:13 0 [ERROR] Aborting
210916 17:30:13 mysqld_safe mysqld from pid file /usr/local/var/mysql/XXXX-MacBookPro.local.pid ended
2021-09-16T15:30:21.6NZ mysqld_safe Logging to '/usr/local/var/mysql/XXXX-MacBookPro.local.err'.
2021-09-16T15:30:21.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2021-09-16T15:30:21.651835Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-09-16T15:30:21.652151Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2021-09-16T15:30:21.652197Z 0 [Note] /usr/local/opt/mysql#5.7/bin/mysqld (mysqld 5.7.35) starting as process 33337 ...
2021-09-16T15:30:21.655210Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2021-09-16T15:30:21.656555Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-09-16T15:30:21.656576Z 0 [Note] InnoDB: Uses event mutexes
2021-09-16T15:30:21.656585Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-09-16T15:30:21.656593Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-09-16T15:30:21.658530Z 0 [Note] InnoDB: Number of pools: 1
2021-09-16T15:30:21.658624Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-09-16T15:30:21.659813Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-09-16T15:30:21.668320Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-09-16T15:30:21.719277Z 0 [ERROR] InnoDB: Only one log file found.
2021-09-16T15:30:21.719324Z 0 [ERROR] InnoDB: Plugin initialization aborted with error not found
2021-09-16T15:30:22.233348Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-09-16T15:30:22.233372Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-09-16T15:30:22.233382Z 0 [ERROR] Failed to initialize builtin plugins.
2021-09-16T15:30:22.233390Z 0 [ERROR] Aborting
2021-09-16T15:30:22.233402Z 0 [Note] Binlog end
2021-09-16T15:30:22.233465Z 0 [Note] Shutting down plugin 'CSV'
2021-09-16T15:30:22.233770Z 0 [Note] /usr/local/opt/mysql#5.7/bin/mysqld: Shutdown complete
This keeps repeating every few seconds.
However, I can now connect to the localhost mysql server and run things using mysql databases # 127.0.0.1 having deleted /usr/local/var/mysql/ib_logfile0
Ran into the same problem. Mariadb was conflicting with a previous mysql installation on my M1 mac.
Removed /opt/homebrew/var/mysql/ folder and reinstalled mariadb. Works fine now.
Related
This is going to be a long one. Please read.
I created an new Azure Ubuntu 18.04 with a 1 TB drive. Setup went fine. Then I installed MySql server using this link. Everything went fine. I was able to start up the mysql with no issues.
My next step was to change the data directory path. I followed this guide. The only difference I changed from the guide was the sudo rsync -av /var/lib/mysql /mnt/MYSQLDATA. When I ran that command, it didn't do anything. Nothing copied over. I replace it with cp * -r /mnt/MYSQLDATA to copy everything over.
I followed the guide to the end. I changed the cnf for mysql /etc/mysql/mysql.conf.d/mysqld.cnf to read:
datadir = /mnt/MYSQLDATA
Next, I changed the alias also sudo nano /etc/apparmor.d/tunables/alias:
`# alias /var/lib/mysql/ -> /mnt/MYSQLDATA/`,
I figured I had to change the [/etc/apparmor.d/usr.sbin.mysqld][3] config. This is the code I used:
# Allow data dir access
/mnt/MYSQLDATA/ r,
/mnt/MYSQLDATA** rwk,
Restarted the apparmor. Everything looked like it was set. I even went to make sure that mysql was the owner of the folder path, so I can chown -R mysql:mysql /mnt/MYSQLDATA. Now it was time to restart the service and it doesnt restart. I keep getting
Job for mysql.service failed because the control process exited with an error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
2022-07-18T23:01:30.236755Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-07-18T23:01:30.236994Z 0 [Warning] Can't create test file /mnt/MYSQLDATA/LEGMYSQLR.lower-test
2022-07-18T23:01:30.237046Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.38-0ubuntu0.18.04.1) starting as process 7569 ...
2022-07-18T23:01:30.240273Z 0 [Warning] Can't create test file /mnt/MYSQLDATA/LEGMYSQLR.lower-test
2022-07-18T23:01:30.240311Z 0 [Warning] Can't create test file /mnt/MYSQLDATA/LEGMYSQLR.lower-test
2022-07-18T23:01:30.244072Z 0 [Note] InnoDB: PUNCH HOLE support available
2022-07-18T23:01:30.244101Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-07-18T23:01:30.244106Z 0 [Note] InnoDB: Uses event mutexes
2022-07-18T23:01:30.244110Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-07-18T23:01:30.244131Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-07-18T23:01:30.244135Z 0 [Note] InnoDB: Using Linux native AIO
2022-07-18T23:01:30.244437Z 0 [Note] InnoDB: Number of pools: 1
2022-07-18T23:01:30.244573Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-07-18T23:01:30.247391Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-07-18T23:01:30.255749Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-07-18T23:01:30.258357Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-07-18T23:01:30.268405Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2022-07-18T23:01:30.268428Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2022-07-18T23:01:30.268444Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2022-07-18T23:01:30.869299Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-07-18T23:01:30.869354Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-07-18T23:01:30.869360Z 0 [ERROR] Failed to initialize builtin plugins.
2022-07-18T23:01:30.869364Z 0 [ERROR] Aborting
2022-07-18T23:01:30.869421Z 0 [Note] Binlog end
2022-07-18T23:01:30.869518Z 0 [Note] Shutting down plugin 'CSV'
2022-07-18T23:01:30.869895Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
I have no idea what I did wrong and where it went wrong. In the journalctl -xe it just shows mysql.services: control process exited, code=exited status=1 or mysql.services: start request repeated too quickly. I am pulling my hair out trying to figure out what went wrong. Please help.
I was also running into similar problem.
The main problem was /mnt/mysqldisk/mysql the mysqldisk was created by my user so in the /var/log/syslog it was complaining it could not write to mysql directory.
I changed the permissions to mysql:mysql using shown on the directory. that should solve your problem
The easiest solution I found is using softlink
This is the final solution I did and you don't need to go through any complicated steps
-stop the mysql server
-sudo cp -a /var/lib/mysql /mnt/mysqldisk/mysql
-sudo mv /var/lib/mysql /var/lib/mysql.bak
` #create a soft link that points to the new mount mysql directory
sudo ln -s /mnt/mysqldisk/mysql/ /var/lib/mysql
Start the mysql service and check it comes up.
you do not need to do any change to /etc/mysql/mysql.conf.d/mysqld.cnf or any Alias etc.
This since to the mysql it looks as if mysql is still at the same place and the original config will still be able to access the new location from the soft link.
This is on ubuntu 18.04 LTS
I can't restart MySQL or recover MySQL from ( InnoDB tables )
I have one WSL using Ubuntu 16.04. By "unknown" accident, at morning i can't access MySQL. Tried to restart it and ... all errors.
Tried with all advice about InnoDB & log* files. But not success.
I did backup /var/lib/mysql and re-install new instance of WSL - Ubuntu 16.04
Tried to recover from physical backup files ( log* & data files & database directory ). But still have same errors.
[Update 1]
Follow this guide: https://dba.stackexchange.com/questions/71596/restoring-mysql-tables-from-ibd-frm-and-mysqllogbin-files
I have re-installed another WSL
Follow guide to restore db from .frm & .idb
Everything goes well until IMPORT TABLESPACE.
MySQL keep saying :
ERROR 1812 (HY000): Tablespace is missing for table `dbname`.`table`
2019-05-16T03:04:36.061132Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2019-05-16T03:04:36.207628Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2019-05-16T03:04:36.208347Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2019-05-16T03:04:36.472045Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-05-16T03:04:36.481592Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.26-0ubuntu0.16.04.1) starting as process 15703 ...
2019-05-16T03:04:36.503219Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-05-16T03:04:36.503655Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-05-16T03:04:36.503712Z 0 [Note] InnoDB: Uses event mutexes
2019-05-16T03:04:36.503749Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-05-16T03:04:36.503783Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2019-05-16T03:04:36.503823Z 0 [Note] InnoDB: Using Linux native AIO
2019-05-16T03:04:36.504677Z 0 [Note] InnoDB: Number of pools: 1
2019-05-16T03:04:36.505431Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-05-16T03:04:36.521629Z 0 [ERROR] InnoDB: Linux Native AIO interface is not supported on this platform. Please check your OS documentation and install appropriate binary of InnoDB.
2019-05-16T03:04:36.521855Z 0 [Note] InnoDB: You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my.cnf
2019-05-16T03:04:36.521899Z 0 [Warning] InnoDB: Linux Native AIO disabled.
2019-05-16T03:04:36.525155Z 0 [Note] InnoDB: Initializing buffer pool, total size = 4G, instances = 8, chunk size = 128M
2019-05-16T03:04:37.245621Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-05-16T03:04:37.452784Z 0 [Note] InnoDB: page_cleaner coordinator priority: -20
2019-05-16T03:04:37.453044Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.453378Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.453477Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.461387Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-05-16T03:04:37.587188Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 22709914082 and the end 22709914054.
2019-05-16T03:04:37.587391Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-05-16T03:04:37.890878Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-05-16T03:04:37.891081Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-05-16T03:04:37.891128Z 0 [ERROR] Failed to initialize builtin plugins.
2019-05-16T03:04:37.891164Z 0 [ERROR] Aborting
2019-05-16T03:04:37.891207Z 0 [Note] Binlog end
2019-05-16T03:04:37.891332Z 0 [Note] Shutting down plugin 'CSV'
2019-05-16T03:04:37.891962Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
2019-05-16T03:04:37.959132Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended ````
For [ERROR] InnoDB: Linux Native AIO interface is not supported on this platform. Please check your OS documentation and install appropriate binary of InnoDB.:
Solution: Add the following lines at /etc/mysql/my.cnf
[mysqld]
innodb_use_native_aio = 0
For [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 92858715 and the end 92858687.:
Solution: Delete the ib_logfiles from /var/lib/mysql
sudo rm -rf /var/lib/mysql/ib_logfile*
I had a similar problem. I was using MySQL in docker but this solution is same for both. You need to remove ib_logfiles
If you are not using docker then
rm -rf /var/lib/mysql/ib_logfile*
And if you using docker then
cd /your_mount_path/
then run
rm -rf * ib_logfile*
Note: Make sure you make a backup of the data or volume as I ended up losing my data.
if anyone's ended up here struggling with wix-embedded-mysql and for some reason can't change the mysql settings in your WSL distro or host unix system, you can just disable it through the custom mysqld setting .withServerVariable like:
.withServerVariable("innodb_use_native_aio", 0)
That option's only doable if you really don't care about InnoDB usage in your code though.
I had mysql running fine on my Mac running High Sierra, 10.13.5. Last night, however, the system rebooted in the middle of the night for some unknown reason and I haven't been able to get things back and running properly since.
When I run brew services start mysql I get:
Successfully startedmysql(label: homebrew.mxcl.mysql)
in response. However, ps aux | grep mysql shows no running server and I cannot log into mysql. If I run, mysql.server start I get:
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/iMac-5K-3.local.pid).
The error file contents are as follows:
2018-06-18T13:51:57.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/iMac-5K-3.local.pid ended
2018-06-18T13:52:07.6NZ mysqld_safe Logging to '/usr/local/var/mysql/iMac-5K-3.local.err'.
2018-06-18T13:52:07.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2018-06-18T13:52:07.837840Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-06-18T13:52:07.838096Z 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.
2018-06-18T13:52:07.838155Z 0 [Note] /usr/local/opt/mysql/bin/mysqld (mysqld 5.7.22) starting as process 8334 ...
2018-06-18T13:52:07.840681Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-06-18T13:52:07.841958Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-18T13:52:07.841975Z 0 [Note] InnoDB: Uses event mutexes
2018-06-18T13:52:07.841983Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-06-18T13:52:07.841990Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-06-18T13:52:07.842257Z 0 [Note] InnoDB: Number of pools: 1
2018-06-18T13:52:07.842356Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-06-18T13:52:07.843494Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-06-18T13:52:07.852043Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-06-18T13:52:07.901671Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-18T13:52:07.902006Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 2700829144 and the end 2700828672.
2018-06-18T13:52:07.902049Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-06-18T13:52:08.338717Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-06-18T13:52:08.338812Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-06-18T13:52:08.338823Z 0 [ERROR] Failed to initialize builtin plugins.
2018-06-18T13:52:08.338835Z 0 [ERROR] Aborting
2018-06-18T13:52:08.338849Z 0 [Note] Binlog end
2018-06-18T13:52:08.338929Z 0 [Note] Shutting down plugin 'CSV'
2018-06-18T13:52:08.339077Z 0 [Note] /usr/local/opt/mysql/bin/mysqld: Shutdown complete
2018-06-18T13:52:08.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/iMac-5K-3.local.pid ended
OK, found the solution here.
I didn't bother with step 1 since I don't have a master/slave setup. I just did:
mv /var/lib/mysql/ib_logfile* ~
I can now start mysql successfully.
This started off as a root password resetting exercise- but been running into various errors: Currently stuck at conflicts on 3306 port. See last few paras of the question if you want to skip the previous steps (I just kept updating the question & title as I made progress). Thank you.
I have a mac with mysql installed- but I cant remember the password hence I've been trying to reset it using: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html (section:B.5.3.2.2 Resetting the Root Password: Unix and Unix-Like Systems).
While running this command:
mysqld --init-file=/home/me/mysql-init &
I got this error:
`[1] 70374
Deepaks-MacBook-Air:data root# 2018-05-06T08:35:29.269289Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T08:35:29.271535Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-06T08:35:29.272815Z 0 [Note] mysqld (mysqld 5.7.21) starting as process 70374 ...
2018-05-06T08:35:29.290319Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-05-06T08:35:29.290429Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2018-05-06T08:35:29.290472Z 0 [ERROR] Aborting
2018-05-06T08:35:29.290494Z 0 [Note] Binlog end
2018-05-06T08:35:29.293896Z 0 [Note] mysqld: Shutdown complete
[1]+ Done(1)`
Hence I'm trying this command:
sudo /usr/local/mysql/support-files/mysql.server start --init-file=/usr/local/mysql/data/mysql-init
but now I'm getting this error:
ERROR! The server quit without updating PID file (/usr/local/mysql/data/Deepaks-MacBook-Air.local.pid).
The following is the content of the log file:
2018-05-06T08:03:52.799002Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T08:03:52.801385Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-06T08:03:52.801495Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.21) starting as process 69954 ...
2018-05-06T08:03:52.810622Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2018-05-06T08:03:52.832273Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-05-06T08:03:52.832306Z 0 [Note] InnoDB: Uses event mutexes
2018-05-06T08:03:52.832313Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-05-06T08:03:52.832319Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-05-06T08:03:52.832780Z 0 [Note] InnoDB: Number of pools: 1
2018-05-06T08:03:52.833783Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-05-06T08:03:52.838027Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-05-06T08:03:52.856588Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-05-06T08:03:52.876537Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-05-06T08:03:52.899436Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-05-06T08:03:52.900043Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-05-06T08:03:52.944160Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-05-06T08:03:52.946174Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-05-06T08:03:52.946218Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-05-06T08:03:52.946641Z 0 [Note] InnoDB: Waiting for purge to start
2018-05-06T08:03:53.001405Z 0 [Note] InnoDB: 5.7.21 started; log sequence number 2551377
2018-05-06T08:03:53.001712Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/mysql-5.7.21-macos10.13-x86_64/data/ib_buffer_pool
2018-05-06T08:03:53.001962Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-05-06T08:03:53.019470Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2018-05-06T08:03:53.020660Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180506 13:33:53
2018-05-06T08:03:53.026724Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2018-05-06T08:03:53.026844Z 0 [Note] IPv6 is available.
2018-05-06T08:03:53.026872Z 0 [Note] - '::' resolves to '::';
2018-05-06T08:03:53.026926Z 0 [Note] Server socket created on IP: '::'.
2018-05-06T08:03:53.087999Z 0 [Note] Event Scheduler: Loaded 0 events
2018-05-06T08:03:53.088163Z 0 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.7.21' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)
2018-05-06T08:12:46.664218Z 2 [Note] Access denied for user 'root'#'localhost' (using password: NO)
2018-05-06T09:35:55.013341Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 2948657ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
Whats wrong and how to fix this?
PS: I've been referring to these two SO, and am trying nearly all solutions in all answers- reseting permissions to removing all files in /usr/local/var/mysql. It still the same issue, I suspect its something to do with mysqld not running properly- is there a special way to run it as root. I'm currently trying to run in root mode in terminal by sudo -i. Can someone help me debug this? Thanks
mysql version:
> mysql --version
mysql Ver 14.14 Distrib 5.7.21, for osx10.12 (x86_64) using EditLine wrapper
UPDATE: I read the security documentation- apparently you aren't supposed to run it as root mode. So I logged out using exit.
Now, I'm getting the following situation:
Deepaks-MacBook-Air:mysql deepak$ mysqld --init-file=/usr/local/mysql/data/mysql-init &
[2] 72004
Deepaks-MacBook-Air:mysql deepak$ mysqld: Can't change dir to '/usr/local/var/mysql/' (Errcode: 2 - No such file or directory)
2018-05-06T10:59:48.877152Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T10:59:48.880902Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-06T10:59:48.881775Z 0 [Note] mysqld (mysqld 5.7.21) starting as process 72004 ...
2018-05-06T10:59:48.897332Z 0 [Warning] Can't create test file /usr/local/var/mysql/Deepaks-MacBook-Air.lower-test
2018-05-06T10:59:48.897395Z 0 [Warning] Can't create test file /usr/local/var/mysql/Deepaks-MacBook-Air.lower-test
2018-05-06T10:59:48.897593Z 0 [ERROR] failed to set datadir to /usr/local/var/mysql/
2018-05-06T10:59:48.897607Z 0 [ERROR] Aborting
2018-05-06T10:59:48.897624Z 0 [Note] Binlog end
2018-05-06T10:59:48.899188Z 0 [Note] mysqld: Shutdown complete
which I suspect is due to the removal of my /usr/local/var/mysql directory as was suggested in one of the other answers. I'd deleted that using rm -rf. I made an new dir mkdir mysql in var and ran mysqld --init-file=/usr/local/mysql/data/mysql-init &, and it initially gives me a pid but then the logs ask me if 3306 port is already occupied:
2018-05-06T11:04:14.215705Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
2018-05-06T11:04:14.218651Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-05-06T11:04:14.225038Z 0 [Note] Salting uuid generator variables, current_pid: 72031, server_start_time: 1525604653, bytes_sent: 0,
2018-05-06T11:04:14.225601Z 0 [Note] Generated uuid: '36553708-511d-11e8-ba65-c83fe4b8ed7b', server_start_time: 1828179975261387404, bytes_sent: 140216128435712
2018-05-06T11:04:14.225667Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 36553708-511d-11e8-ba65-c83fe4b8ed7b.
2018-05-06T11:04:14.241961Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-06T11:04:14.391057Z 0 [Note] Auto generated SSL certificates are placed in data directory.
2018-05-06T11:04:14.391874Z 0 [Warning] CA certificate ca.pem is self signed.
2018-05-06T11:04:14.490103Z 0 [Note] Auto generated RSA key files are placed in data directory.
2018-05-06T11:04:14.499147Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2018-05-06T11:04:14.499239Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2018-05-06T11:04:14.499424Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2018-05-06T11:04:14.499495Z 0 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
2018-05-06T11:04:14.499503Z 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2018-05-06T11:04:14.499536Z 0 [ERROR] Aborting
I actually have two folders in my /usr/local/ - mysql and mysql-5.7.21-macos10.13-x86_64. The whole process so far, I've been running in the 'mysqlfolder and haven't really touchedmysql-5.7.21-macos10.13-x86_64`. They seem to have the same directory structure inside.
Also when I do ps aux | grep mysql, I get three processes:
Deepaks-MacBook-Air:local deepak$ ps aux | grep mysql
deepak 72071 100.0 0.0 2443044 1992 s002 S+ 4:44PM 0:00.01 grep mysql
_mysql 71985 0.0 0.2 2852472 13132 ?? Ss 4:25PM 0:00.66 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid --keyring-file-data=/usr/local/mysql/keyring/keyring --early-plugin-load=keyring_file=keyring_file.so
root 71967 0.0 0.1 2460804 7992 s002 T 4:23PM 0:00.03 sudo mysqld --init-file=/usr/local/mysql/data/mysql-init
However, when I proceed to kill the second or the third one, they simply reappear when I do ps aux again.
Also, I usually use a portforwarding to connect to a remote MySQL host. So, every once a while and in local scripts I run "ssh -fNT -L 3307:localhost:3306 -i ~/key/deepak_ubuntu_16feb.pem ubuntu#ec2-AWS-HOS-TNA-ME.compute-1.amazonaws.com"
Could this be a conflict?
UPDATE:
OK, I ignored the other directory and simply changed the port, that seemed to now avoid the conflict, but now has a different problem: mysql.sock.lock cant be accessed?
Deepaks-MacBook-Air:mysql deepak$ mysqld --init-file=/usr/local/mysql/data/mysql-init --port=3308 &
[2] 72160
Deepaks-MacBook-Air:mysql deepak$ 2018-05-06T11:32:45.441642Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T11:32:45.443453Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-06T11:32:45.444202Z 0 [Note] mysqld (mysqld 5.7.21) starting as process 72160 ...
2018-05-06T11:32:45.463651Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-05-06T11:32:45.478310Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-05-06T11:32:45.478366Z 0 [Note] InnoDB: Uses event mutexes
2018-05-06T11:32:45.478375Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-05-06T11:32:45.478384Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-05-06T11:32:45.480830Z 0 [Note] InnoDB: Number of pools: 1
2018-05-06T11:32:45.483263Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-05-06T11:32:45.487576Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-05-06T11:32:45.507092Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-05-06T11:32:45.538289Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-05-06T11:32:45.565701Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-05-06T11:32:45.565987Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-05-06T11:32:45.622322Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-05-06T11:32:45.623627Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-05-06T11:32:45.623652Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-05-06T11:32:45.623974Z 0 [Note] InnoDB: Waiting for purge to start
2018-05-06T11:32:45.678385Z 0 [Note] InnoDB: 5.7.21 started; log sequence number 1209980
2018-05-06T11:32:45.678936Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/var/mysql/ib_buffer_pool
2018-05-06T11:32:45.680200Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-05-06T11:32:45.680346Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180506 17:02:45
mysqld: Table 'mysql.plugin' doesn't exist
2018-05-06T11:32:45.680885Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-05-06T11:32:45.684081Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-06T11:32:45.686185Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-05-06T11:32:45.686212Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2018-05-06T11:32:45.691365Z 0 [Warning] CA certificate ca.pem is self signed.
2018-05-06T11:32:45.691562Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2018-05-06T11:32:45.693912Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3308
2018-05-06T11:32:45.694589Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2018-05-06T11:32:45.694853Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2018-05-06T11:32:45.695047Z 0 [ERROR] Could not open unix socket lock file /tmp/mysql.sock.lock.
2018-05-06T11:32:45.695067Z 0 [ERROR] Unable to setup unix socket lock file.
2018-05-06T11:32:45.695092Z 0 [ERROR] Aborting
OK, so I went into /tmp/ and tried to check permissions of the file- below are the results:
Deepaks-MacBook-Air:tmp deepak$ stat mysql.sock.lock
16777220 3413029 -rw------- 1 _mysql wheel 0 6 "May 6 16:25:35 2018" "May 6 16:25:35 2018" "May 6 16:25:35 2018" "May 6 16:25:35 2018" 4096 8 0 mysql.sock.lock
Deepaks-MacBook-Air:tmp deepak$ stat mysql.sock
16777220 3413030 srwxrwxrwx 1 _mysql wheel 0 0 "May 6 16:25:44 2018" "May 6 16:25:44 2018" "May 6 16:25:44 2018" "May 6 16:25:35 2018" 4096 0 0 mysql.sock
I'm trying the solutions from this SO post https://stackoverflow.com/questions/34954455/mysql-daemon-lock-issue, the change owner answer did not work. I'm a little hesitant to remove locking.
OK, this post: https://support.rackspace.com/how-to/checking-linux-file-permissions-with-ls/ quite neatly explains how to read those permissions- apparently in my case _mysql user and wheel are the owner and group respectively. That doesn't make sense because I've never come across wheel in anything out side a .whl context and I haven't encountered the _mysql before today. I've tried to change to that user earlier using su - _mysql and I couldn't guess the password- not sure if mysql sets this up by default, in which case I'm confused right about now.
UPDATE:
OK, I solved that my Chowning it:
Deepaks-MacBook-Air:tmp deepak$ sudo chown deepak mysql.sock
Deepaks-MacBook-Air:tmp deepak$ sudo chown deepak mysql.sock.lock
Deepaks-MacBook-Air:tmp deepak$ stat mysql.sock.lock
16777220 3413029 -rw------- 1 deepak wheel 0 6 "May 6 16:25:35 2018" "May 6 16:25:35 2018" "May 6 17:26:54 2018" "May 6 16:25:35 2018" 4096 8 0 mysql.sock.lock
Deepaks-MacBook-Air:tmp deepak$ stat mysql.sock
16777220 3413030 srwxrwxrwx 1 deepak wheel 0 0 "May 6 16:25:44 2018" "May 6 16:25:44 2018" "May 6 17:26:22 2018" "May 6 16:25:35 2018" 4096 0 0 mysql.sock
However, that gives rise to another error:
Can't open and lock privilege tables: Table 'mysql.user' doesn't exist.
Deepaks-MacBook-Air:mysql deepak$ mysqld --init-file=/usr/local/mysql/data/mysql-init --port=3308 &
[2] 72244
Deepaks-MacBook-Air:mysql deepak$ 2018-05-06T11:57:33.454182Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T11:57:33.456455Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-06T11:57:33.457505Z 0 [Note] mysqld (mysqld 5.7.21) starting as process 72244 ...
2018-05-06T11:57:33.470925Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-05-06T11:57:33.482170Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-05-06T11:57:33.482216Z 0 [Note] InnoDB: Uses event mutexes
2018-05-06T11:57:33.482224Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-05-06T11:57:33.482231Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-05-06T11:57:33.486263Z 0 [Note] InnoDB: Number of pools: 1
2018-05-06T11:57:33.489217Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-05-06T11:57:33.494624Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-05-06T11:57:33.513877Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-05-06T11:57:33.546517Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-05-06T11:57:33.575022Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-05-06T11:57:33.575404Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-05-06T11:57:33.620985Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-05-06T11:57:33.622662Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-05-06T11:57:33.622693Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-05-06T11:57:33.623068Z 0 [Note] InnoDB: Waiting for purge to start
2018-05-06T11:57:33.677963Z 0 [Note] InnoDB: 5.7.21 started; log sequence number 1209999
2018-05-06T11:57:33.679157Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/var/mysql/ib_buffer_pool
2018-05-06T11:57:33.680426Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180506 17:27:33
2018-05-06T11:57:33.681987Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
2018-05-06T11:57:33.684004Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-05-06T11:57:33.688066Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-06T11:57:33.690386Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-05-06T11:57:33.690502Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2018-05-06T11:57:33.694745Z 0 [Warning] CA certificate ca.pem is self signed.
2018-05-06T11:57:33.694856Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2018-05-06T11:57:33.695461Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3308
2018-05-06T11:57:33.696028Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2018-05-06T11:57:33.696184Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2018-05-06T11:57:33.700436Z 0 [Warning] Failed to open optimizer cost constant tables
2018-05-06T11:57:33.704524Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2018-05-06T11:57:33.704983Z 0 [ERROR] Aborting
Alright, that got resolved by changing the owner from _mysql to my normal account using chown but now the the issue is:
Deepaks-MacBook-Air:mysql deepak$ mysqld --initialize-insecure --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --init-file=/usr/local/mysql/mysql-init --port=3308 &
[2] 72328
Deepaks-MacBook-Air:mysql deepak$ 2018-05-06T12:21:01.547203Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T12:21:01.550869Z 0 [ERROR] Can't find error-message file '/usr/local/mysql-5.7.21-macos10.13-x86_64/share/mysql/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2018-05-06T12:21:01.557694Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2018-05-06T12:21:01.557751Z 0 [ERROR] Aborting
Here is how I resolved this: the share folder didn't have a mysql directory and instead had the errmsg.sys in the english directory, I simply copied this file into a new directory I created in the share folder: mkdir mysql.
This worked but then showed:
Can't create directory '/usr/local/mysql/data/' (Errcode: 13 - Permission denied)
2018-05-06T12:49:13.313038Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T12:49:13.316262Z 0 [Warning] Using pre 5.5 semantics to load error messages from /usr/local/mysql-5.7.21-macos10.13-x86_64/share/mysql/.
2018-05-06T12:49:13.316285Z 0 [Warning] If this is not intended, refer to the documentation for valid usage of --lc-messages-dir and --language parameters.
2018-05-06T12:49:13.322333Z 0 [ERROR] Aborting
Using chown, I changed the owner of mysql directory to my regular user account (strangely the mysql-5.7.21-macos10.13-x86_64 directory would not change its owner from group from root and wheel to anything even if I sudo'ed it.
So now the mysqld --initialize-insecure --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --init-file=/usr/local/mysql/mysql-init --port=3308 & command from /usr/local/mysql/ shows the following output:
Deepaks-MacBook-Air:local deepak$ mysqld --initialize-insecure --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --init-file=/usr/local/mysql/mysql-init --port=3308 &
[2] 72460
Deepaks-MacBook-Air:local deepak$ 2018-05-06T12:52:51.009693Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T12:52:51.013089Z 0 [Warning] Using pre 5.5 semantics to load error messages from /usr/local/mysql-5.7.21-macos10.13-x86_64/share/mysql/.
2018-05-06T12:52:51.013108Z 0 [Warning] If this is not intended, refer to the documentation for valid usage of --lc-messages-dir and --language parameters.
2018-05-06T12:52:51.020232Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2018-05-06T12:52:51.549560Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-05-06T12:52:51.614133Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-05-06T12:52:51.692927Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 630bcd34-512c-11e8-934a-45e8be00c2cf.
2018-05-06T12:52:51.711501Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-06T12:52:51.847929Z 0 [Warning] CA certificate ca.pem is self signed.
2018-05-06T12:52:51.903182Z 1 [Warning] root#localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
This seemed good but nothing is happening. Is this it? Can I start connecting using my SequelPro to 'localhost:3308' now? or is there some other caveats I need to resolve like setting temp password? Before even that, do I need to go into another terminal window to try mysql -u root and leave this running or what?
Also, when I don ps aux | grep mysql it shows three processes as before but does not show 72460 the one that mysqld just showed me now. Is this something I need to be concerned about?
This is the first time I'm doing this, and I'm scared to do anything right about now to not ruin the last few hours of efforts to fix this.
How do I resolve this? Thanks!
UPDATE: FINAL ISSUES:
OK, I'm dealing with a final set of issues, gonna ask in a seperate question.
1)
Deepaks-MacBook-Air:App deepak$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
and
2)
Deepaks-MacBook-Air:App deepak$ mysqladmin -u root
mysqladmin Ver 8.42 Distrib 5.7.21, for osx10.12 on x86_64
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Administration program for the mysqld daemon.
Usage: mysqladmin [OPTIONS] command command....
3) In my System Preferences > MySQL, it says "MySQL server instance is STOPPED".
Firstly, the issue with running as root is that mysqld doesn't want to have root privileges. You're not wrong to run it as root though, since the data directory should by default not be writable to your own user. Simply tell it to drop privileges and run as the "mysql" user, which is the default user mysqld runs under on macOS and likely the user who owns the data directory (note that "_mysqld" and "mysql" refer to the same user on macOS for historical reasons). You do this by adding -u mysql to mysqld's command line.
The two directories should really be only one directory (with the long name that includes a version number) and one symbolic link (/usr/local/mysql pointing to the directory). That's how the MySQL installer sets things up, the symlink always points to the latest version of MySQL that was installed.
The other mysqld you see running is the one started from launchd. This is also something the MySQL installer sets up. You can use the MySQL preference pane (which should be installed by default) to shut it down. Otherwise, macOS will keep restarting it because it interprets the shutdowns as random failures. The preference pane should be somewhere at the end of the bottom row in System Preferences.
The port forwarding thing should not be an issue. It will only be active while the ssh connection is up, and it doesn't even forward the same local port.
MySQL (Percona 5.6) will not start.
This error has happened to me several times. Each time, I have had to remove MySQL data directories and reinstall MySQL.
Is there another way to fix MySQL? (Specifically one in which the data not blown away?)
/var/log/mysql/error.log
150214 16:36:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2015-02-14 16:36:40 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2015-02-14 16:36:40 0 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
2015-02-14 16:36:40 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-02-14 16:36:40 1018 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
2015-02-14 16:36:40 1018 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Incorrect file format 'plugin'
2015-02-14 16:36:40 1018 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2015-02-14 16:36:40 1018 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-02-14 16:36:40 1018 [Note] InnoDB: The InnoDB memory heap is disabled
2015-02-14 16:36:40 1018 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-02-14 16:36:40 1018 [Note] InnoDB: Memory barrier is not used
2015-02-14 16:36:40 1018 [Note] InnoDB: Compressed tables use zlib 1.2.8
2015-02-14 16:36:40 1018 [Note] InnoDB: Using Linux native AIO
2015-02-14 16:36:40 1018 [Note] InnoDB: Using CPU crc32 instructions
2015-02-14 16:36:40 1018 [Note] InnoDB: Initializing buffer pool, size = 256.0M
2015-02-14 16:36:40 1018 [Note] InnoDB: Completed initialization of buffer pool
2015-02-14 16:36:40 1018 [Note] InnoDB: Highest supported file format is Barracuda.
2015-02-14 16:36:40 1018 [Note] InnoDB: The log sequence numbers 714340126 and 714340126 in ibdata files do not match the log sequence number 716513090 in the ib_logfiles!
2015-02-14 16:36:40 1018 [Note] InnoDB: Database was not shutdown normally!
2015-02-14 16:36:40 1018 [Note] InnoDB: Starting crash recovery.
2015-02-14 16:36:40 1018 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-02-14 16:36:40 1018 [Note] InnoDB: Restoring possible half-written data pages
2015-02-14 16:36:40 1018 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Last MySQL binlog file position 0 292596, file name binlog.000056
2015-02-14 16:36:40 1018 [Note] InnoDB: 128 rollback segment(s) are active.
2015-02-14 16:36:40 1018 [Note] InnoDB: Waiting for purge to start
2015-02-14 16:36:40 1018 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.21-70.1 started; log sequence number 716513090
2015-02-14 16:36:40 1018 [Note] Recovering after a crash using binlog
2015-02-14 16:36:40 1018 [Note] Starting crash recovery...
2015-02-14 16:36:40 1018 [Note] Crash recovery finished.
2015-02-14 16:36:40 1018 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2015-02-14 16:36:40 1018 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2015-02-14 16:36:40 1018 [Note] Server hostname (bind-address): '*'; port: 3306
2015-02-14 16:36:40 1018 [Note] IPv6 is available.
2015-02-14 16:36:40 1018 [Note] - '::' resolves to '::';
2015-02-14 16:36:40 1018 [Note] Server socket created on IP: '::'.
2015-02-14 16:36:40 1018 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect file format 'user'
150214 16:36:40 mysqld_safe mysqld from pid file /tmp/mysqld.pid ended
I managed so solve this problem with answer from ruby.b
You'll have to repair your host table. To do this, issue the following command to start your server bypassing the privilege system
In one terminal, run
$ sudo mysqld --skip-grant-tables
Open another terminal and execute these commands
$ mysql
mysql> use mysql
mysql> repair table host use_frm;
mysql> exit
And restart the mysql service
$ sudo service mysql restart
Thanks to John for putting me on the right track, I had a few other hoops to jump through on my system. Hope this helps someone.
This is a corrupt privilege table. Maybe caused by an upgrade or power failure. My system OpenSUSE 13.2, MySQL 5.6. Simple reinstall does not fix, must delete all traces of MySQL before reinstall OR…
Close down all instances of MySQL
$ systemctl stop mysql.service
$ pkill -9 mysqld
Start server bypassing privilege system
$ sudo mysqld_safe --user=root --skip-grant-tables
Start MySQL command line tool
$ mysql
If you receive
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
mysqld_safe is running with its socket somewhere else. Find it with.
$ sudo find / -type s
Mine was in /var/run/mysql/
Edit the socket line in my.cnf, making a note of your existing socket setting.
My line became
socket=/var/run/mysql/mysql.sock
Return to 'Close down all instances of MySQL' (the top of these instructions). Follow them through to 'Start MySQL command line tool'. Hopefully you can open mysql successfully. From mysql command line.
mysql> use mysql
mysql> repair table user use_frm;
mysql> exit
Close down all instances of MySQL
$ systemctl stop mysql.service
$ pkill -9 mysqld
Re-edit my.cnf, returning the socket line to its original setting.
I had to reset permissions on 2 files in my mysql data directory.
$ chown mysql:mysql server2.err
$ chown mysql:mysql server2.pid
Start the MySQL server
$ systemctl start mysql.service
I then got the same original error with another table (db)
[ERROR] Fatal error: Can't open and lock privilege tables: Incorrect file format 'db'
And had to repeat the above procedure multiple times altering the 'repair' command until all privilege tables were fixed.
mysql> repair table db use_frm;
Here is the setup for #John Linhart's answer, if you're running Docker:
First, start a new docker container with the appropriate tag from the mysql-container (the same you used to write the DB with).
$ docker run --rm -it -v <named_volume>:/var/lib/mysql mysql:<tag> /bin/bash
This will launch a new container with the correct named volume (or mounted volume) mounted in the container and drop you into a shell as root. The mysqld-Daemon will refuse to launch as root though, so we'll run it as the mysql-user:
$ whoami
root
$ which mysqld
/usr/sbin/mysqld
$ su mysql
$ whoami
mysql
$ /usr/sbin/mysqld --skip-grant-tables
....
Now to run the SQL commands, we'll connect to the running container from a new terminal:
$ docker ps
CONTAINER ID [...]
abc123 [...]
$ docker exec -it abc123 /bin/bash
# We're on the container now!
$ whoami
root
$ mysql
...
And continue from there. When you're done, leave the container on the second terminal via exit. The terminal running mysqld will not respond to CMD+C, so we'll stop the container via Docker:
$ docker ps
CONTAINER ID [...]
abc123 [...]
$ docker stop abc123