Unable to start MYSQL service after data directory change - mysql

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

Related

Can't restart MySQL caused by InnoDB

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.

MySQL server doesn't run via MAMP on mac OS

I upgraded my MAMP PRO 3.5.2 version to the 5th and MySQL start fails.
I killed mysqld processes via killall -9 mysqld, cleaned log files like ib_logfile* and tried manipulations with innodb recovery.
The log I've got looks like this:
2018-10-10T14:16:12.6NZ mysqld_safe Logging to '/Applications/MAMP/logs/mysql_error.log'.
2018-10-10T14:16:12.6NZ mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql57
2018-10-10T14:16:13.043096Z 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-10-10T14:16:13.051110Z 0 [Note] /Applications/MAMP/Library/bin/mysqld (mysqld 5.7.23) starting as process 5538 ...
2018-10-10T14:16:13.064223Z 0 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql57/ is case insensitive
2018-10-10T14:16:13.074890Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-10-10T14:16:13.074926Z 0 [Note] InnoDB: Uses event mutexes
2018-10-10T14:16:13.074936Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-10-10T14:16:13.074943Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-10-10T14:16:13.074972Z 0 [Note] InnoDB: Adjusting innodb_buffer_pool_instances from 8 to 1 since innodb_buffer_pool_size is less than 1024 MiB
2018-10-10T14:16:13.079521Z 0 [Note] InnoDB: Number of pools: 1
2018-10-10T14:16:13.084840Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-10-10T14:16:13.089357Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-10-10T14:16:13.114376Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-10-10T14:16:13.140491Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-10-10T14:16:13.145746Z 0 [ERROR] InnoDB: Trying to access page number 527111 in space 0, space name innodb_system, which is outside the tablespace bounds. Byte offset 0, len 16384, i/o type read. If you get this error at mysqld startup, please check that your my.cnf matches the ibdata files that you have in the MySQL server.
2018-10-10T14:16:13.145772Z 0 [ERROR] InnoDB: Server exits.
2018-10-10T14:16:13.6NZ mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
Would appreciate any hint which direction to go as I start to consider to uninstall and reinstall of MAMP which means I will lose few local DB installations.
Thanks!
So the issue was solved and MySQL runs locally via MAMP 5.1.
While figuring out what was going wrong in the my.cnf following settings were applied:
increased innodb_buffer_pool_size value: innodb_buffer_pool_size = 1024M
force recovery mode was on innodb_force_recovery = 1
That lead to the error that mentioned in the question:
[ERROR] InnoDB: Trying to access page number 527111 in space 0, space name innodb_system, which is outside the tablespace bounds. Byte offset 0, len 16384, i/o type read. If you get this error at mysqld startup, please check that your my.cnf matches the ibdata files that you have in the MySQL server.
At this point default settings for the ibdata dir and path were uncommented inside of my.cnf:
innodb_data_home_dir = "/Library/Application Support/appsolute/MAMP PRO/db/mysql57"
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = "/Library/Application Support/appsolute/MAMP PRO/db/mysql57"
Error log was reported on access limits (don't have an exact sentence at front of me), was lost a bit here, and as a guess measure, I extended rights for the folder /Library/Application Support/appsolute/MAMP PRO/db/mysql57 to my current user.
That didn't change the log. The error about a wrong path to the ibdata was still there.
In the end the renaming of the folder mysql (where was the full version of ibdata (~40Gb)) to mysql57 helped.
There was following folder structure in /Library/Application Support/appsolute/MAMP PRO/db/ after the installation of MAMP 5.1:
-- mysql
-- mysql56_TIMESTAMP
-- mysql57
with the same structure of files, but a closer comparison of the content showed that the full version of the file inside of mysql, so renamed it, and removed all folders after tests that MAMP works correctly without them.
So now I have only one mysql folder inside of /Library/Application Support/appsolute/MAMP PRO/db/. The settings inside of my.cnf that I customized in the process rolled back.

mysql says root#localhost is created with an empty password ! But nothings happening. did I miss something?

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.

CentOS 7 - MySQL 5.7 re-installation corrupted data

I have a CentOS 7 virtual machine with a DirectAdmin installation. It used to run a MySQL 5.6 installation, built using DirectAdmin Custombuild 2.0. I wanted some functionality (e.g. JSON ops) that was not available in MySQL 5.6, so I manually installed MySQL 5.7 from the MySQL repo using the guide on https://www.tecmint.com/install-latest-mysql-on-rhel-centos-and-fedora/.
This worked fine up until a few days ago, when I needed to rebuild my Custombuild installation and it obviously overwrote the MySQL installation with version 5.6. I did NOT make a backup of the databases (I know, really stupid and I regret it).
After the Custombuild overwrite, I re-installed MySQL 5.7 using the same guide. When I now try to start it, I get the following:
[riccardo#server ~]$ sudo systemctl start mysqld
[sudo] password for riccardo:
Job for mysqld.service failed because the control process exited with
error code. See "systemctl status mysqld.service" and "journalctl
-xe" for details.
The log in /var/log/mysqld.log says the following:
2018-05-27T17:42:02.769069Z 0 [Warning] TIMESTAMP with implicit
DEFAULT value is deprecated. Please use
--explicit_defaults_for_timestamp server option (see documentation for
more details).
2018-05-27T17:42:02.770667Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.22)
starting as process 31752 ...
2018-05-27T17:42:02.773699Z 0 [Note] InnoDB: PUNCH HOLE support
available
2018-05-27T17:42:02.773726Z 0 [Note] InnoDB: Mutexes and rw_locks use
GCC atomic builtins
2018-05-27T17:42:02.773731Z 0 [Note] InnoDB: Uses event mutexes
2018-05-27T17:42:02.773734Z 0 [Note] InnoDB: GCC builtin
__atomic_thread_fence() is used for memory barrier
2018-05-27T17:42:02.773739Z 0 [Note] InnoDB: Compressed tables use
zlib 1.2.3
2018-05-27T17:42:02.773742Z 0 [Note] InnoDB: Using Linux native AIO
2018-05-27T17:42:02.773999Z 0 [Note] InnoDB: Number of pools: 1
2018-05-27T17:42:02.774100Z 0 [Note] InnoDB: Using CPU crc32
instructions
2018-05-27T17:42:02.775492Z 0 [Note] InnoDB: Initializing buffer pool,
total size = 128M, instances = 1, chunk size = 128M
2018-05-27T17:42:02.783306Z 0 [Note] InnoDB: Completed initialization
of buffer pool
2018-05-27T17:42:02.786037Z 0 [Note] InnoDB: If the mysqld execution
user is authorized, page cleaner thread priority can be changed. See
the man page of setpriority().
2018-05-27T17:42:02.797885Z 0 [ERROR] [FATAL] InnoDB: Table flags are
0 in the data dictionary but the flags in file ./ibdata1 are 0x4000!
2018-05-27 19:42:02 0x7efd82b32740 InnoDB: Assertion failure in
thread 139627284604736 in file ut0ut.cc line 942
Hence, it looks like the InnoDB data is corrupted. I tried starting using
[mysqld]
innodb_force_recovery = x
in /etc/my.cnf with values 1-6 for x. This didn't help.
As for my question: is there any chance of recovering the data, with or without the help of MySQL?

MySQL57 service on Local Computer started and then stopped

I'm having a problem with mySql. It is stopped and when I try to start it, I get the following: "MySQL57 service on Local Computer started and then stopped." as you can see in the following image:
My server log is the following:
2017-04-05T10:04:58.085384Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-04-05T10:04:58.085384Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2017-04-05T10:04:58.087363Z 0 [Note] C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe (mysqld 5.7.9-log) starting as process 7852 ...
2017-04-05T10:04:58.108397Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2017-04-05T10:04:58.109398Z 0 [Note] InnoDB: Uses event mutexes
2017-04-05T10:04:58.109398Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier
2017-04-05T10:04:58.110399Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-04-05T10:04:58.110399Z 0 [Note] InnoDB: Adjusting innodb_buffer_pool_instances from 8 to 1 since innodb_buffer_pool_size is less than 1024 MiB
2017-04-05T10:04:58.116403Z 0 [Note] InnoDB: Number of pools: 1
2017-04-05T10:04:58.116403Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2017-04-05T10:04:58.156434Z 0 [Note] InnoDB: Initializing buffer pool, total size = 8M, instances = 1, chunk size = 8M
2017-04-05T10:04:58.158435Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-04-05T10:04:58.200443Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-04-05T10:04:58.207479Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 43061044961
2017-04-05T10:04:58.208477Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 43061045173
2017-04-05T10:04:58.209476Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 43061044961 and the end 43061045173.
2017-04-05T10:04:58.210477Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-04-05T10:04:58.514809Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-04-05T10:04:58.515786Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-04-05T10:04:58.515786Z 0 [ERROR] Failed to initialize plugins.
2017-04-05T10:04:58.516785Z 0 [ERROR] Aborting
2017-04-05T10:04:58.517786Z 0 [Note] Binlog end
2017-04-05T10:04:58.517786Z 0 [Note] Shutting down plugin 'CSV'
2017-04-05T10:04:58.519788Z 0 [Note] C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe: Shutdown complete
I have tried, some options like turn off innodb_log_checksums via command line or set innodb_log_checksums = 0 in configure file. and then restart, or this one in stackoverflow but It is still stopped.
What can I do? Can some one help me?
Thank you
Run the command from the command prompt; it's the only effective way to see the error message that services return that you will not see using the built-in Windows Services program.
Either double-click the service or right-click to click on Properties.
Click on the Path to executable.
Press the Home key and then hold Shift while pressing the End key to highlight the entire command.
Hold the Control key and then press C to copy.
Run the command prompt (usually Start -> Run -> cmd -> Okay) or make a new shortcut and just type cmd for the command.
In the commend prompt right-click.
Left-click on paste.
Press Enter to run the command.
Research the problem with your preferred search engine, use "quote operators" around the error message to limit results if there are too many unrelated results.
Just had this problem, way i solved it was:
In the command prompt go to mysql location mysql\bin (use cd .. to go back one folder or cd name_of_folder to access it)
In this location, type mysqld --initialize
here what I did and it worked. MySQL keep backup of your my.ini files in C:\ProgramData\MySQL\MySQL Server 8.0 directory in windows, rename a recent backup of *.ini to my.ini