After changing mysql directory, Mysql will no longer start up - mysql

I am running a debian machine and I am trying to move my mysql data directory. After looking at a few online tutorials, it looks like the way to do this is changing the datadir in the my.cnf. Some of the tutorials also talk about changing some apparmor files, but it does not look like I have apparmor installed.
After I changed the my.cnf I would keep on getting the following error in the syslog:
Jul 16 16:21:04 sparta /etc/init.d/mysql[29315]: #007/usr/bin/mysqladmin: connect to server at 'localhost' failed
Jul 16 16:21:04 sparta /etc/init.d/mysql[29315]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Jul 16 16:21:04 sparta /etc/init.d/mysql[29315]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
After looking around a little more I came upon a website that said I should also change the directory for the socket. So I did that, but I still get the same issue.
When I run sudo mysqld start I get the following error:
150716 16:25:54 [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.
150716 16:25:54 [Note] mysqld (mysqld 5.5.43-0+deb7u1) starting as process 29416 ...
150716 16:25:54 [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.
150716 16:25:54 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
150716 16:25:54 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
150716 16:25:54 InnoDB: The InnoDB memory heap is disabled
150716 16:25:54 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150716 16:25:54 InnoDB: Compressed tables use zlib 1.2.7
150716 16:25:54 InnoDB: Using Linux native AIO
150716 16:25:54 InnoDB: Initializing buffer pool, size = 128.0M
150716 16:25:54 InnoDB: Completed initialization of buffer pool
150716 16:25:54 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
Here is a copy of the part of my.cnf file that I edited:
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /mysql_persistant/
port = 3306
basedir = /usr
datadir = /mysql_persistant/
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
I have also chmod 755 the new file directory.

So it seems like the issue was running a chown -R on the directory that I was changing the data too.
It is not necessary to change the location of the socket.

Related

Unable to start MYSQL service after data directory change

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

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.

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) (error 2002)

I know this is a question many times asked, but I can't seem to find any solution out of the other topics.
what I've tried:
reinstalling mysql-server (so not the client)
chown mysql:mysql /var/lib/mysql
checked out my.cnf where everything seems correct
changed bind-address to localhost
at a certain point it seemed I had no socket file and
sudo find / -type s | grep mysqld.sock doesn't give any result.
Edit
I now entered mysql_config --socket and it seems there is a socket file in place now at /var/run/mysqld/mysqld.sock
also checked apparmor_status which gave following result:
apparmor module is loaded.
14 profiles are loaded.
14 profiles are in enforce mode.
/sbin/dhclient
/usr/bin/evince
/usr/bin/evince-previewer
/usr/bin/evince-previewer//sanitized_helper
/usr/bin/evince-thumbnailer
/usr/bin/evince-thumbnailer//sanitized_helper
/usr/bin/evince//sanitized_helper
/usr/lib/NetworkManager/nm-dhcp-client.action
/usr/lib/connman/scripts/dhclient-script
/usr/lib/cups/backend/cups-pdf
/usr/sbin/cups-browsed
/usr/sbin/cupsd
/usr/sbin/mysqld
/usr/sbin/tcpdump
0 profiles are in complain mode.
3 processes have profiles defined.
0 processes are in enforce mode.
0 processes are in complain mode.
3 processes are unconfined but have a profile defined.
/sbin/dhclient (1089)
/usr/sbin/cups-browsed (1415)
/usr/sbin/cupsd (16608)
After all this /etc/init.d/mysql start still fails
settings in my.cnf
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
I checked out /var/log/error.log and when I try # /etc/init.d/mysql start following reports show up from the log:
150528 22:58:19 [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.
150528 22:58:19 [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.
150528 22:58:19 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.14.04.1) starting as process 14608 ...
150528 22:58:19 [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.
150528 22:58:19 [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.
150528 22:58:19 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
150528 22:58:19 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
150528 22:58:19 InnoDB: The InnoDB memory heap is disabled
150528 22:58:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150528 22:58:19 InnoDB: Compressed tables use zlib 1.2.8
150528 22:58:19 InnoDB: Using Linux native AIO
150528 22:58:19 InnoDB: Initializing buffer pool, size = 128.0M
150528 22:58:19 InnoDB: Completed initialization of buffer pool
150528 22:58:19 InnoDB: highest supported file format is Barracuda.
150528 22:58:19 InnoDB: Waiting for the background threads to start
150528 22:58:20 InnoDB: 5.5.43 started; log sequence number 140421610
150528 22:58:20 [Note] Server hostname (bind-address): 'localhost'; port: 3306
150528 22:58:20 [Note] - 'localhost' resolves to '127.0.0.1';
150528 22:58:20 [Note] Server socket created on IP: '127.0.0.1'.
150528 22:58:20 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
150528 22:58:20 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
150528 22:58:20 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Can someone help me out how to get it fixed without loosing my db's
Your mysql install is hosed:
150528 22:58:20 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
It's not starting up in the first place, hence not having a socket file. You're missing data from the internal/core mysql database, which is a very bad sign.
If you haven't initialized the data directory, now is the time to initialize it before starting mysqld.
You can run either of these 2 scripts provided by mysql. From your shell prompt run them as:
# mysql_secure_installation
or
# mysql_install_db --user=mysql \
--basedir=<path to mysql install dir> \
--datadir=/var/lib/mysql/data
mysql_install_db will invoke mysqld with --bootstrap and --skip-grant-tables options.
The mysql_install_db cmd did the trick. I have a socket again and I"m now able to login to mysql again. Thx

Getting error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed" when starting MySQL

I found many similar question on Stackoverflow but didn't get the exact error solution.
My issue is when starting MySQL service on one of the Dedicated Centos 6.5 machine, I am getting error :
141018 05:13:46 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
141018 5:13:47 [Warning] Can't create test file /var/lib/mysql/ip-184-168-73-83.lower-test
141018 5:13:47 [Warning] Can't create test file /var/lib/mysql/ip-184-168-73-83.lower-test
/usr/libexec/mysqld: Can't create/write to file '/tmp/ibkTWnhE' (Errcode: 28)
141018 5:13:48 InnoDB: Error: unable to create temporary file; errno: 28
141018 5:13:48 [ERROR] Plugin 'InnoDB' init function returned error.
141018 5:13:48 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
141018 5:13:48 [ERROR] Can't start server : Bind on unix socket: No space left on device
141018 5:13:48 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
141018 5:13:48 [ERROR] Aborting
141018 5:13:48 [Note] /usr/libexec/mysqld: Shutdown complete
141018 05:13:48 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Here are free command status:
free -m
total used free shared buffers cached
Mem: 3743 3631 111 0 2705 21
-/+ buffers/cache: 905 2838
Swap: 2047 0 2047
This error also happens when your Database data is corrupt. You may fix this issue by moving your Db data files (ib_logfile0 and ib_logfile1) mentioned below to another location. ib_logfile0 and ib_logfile1 are system tablespace for the InnoDB infrastructure. These files contains several classes for information vital for InnoDB. You may read about these files here.
Before following below steps please keep a copy of files (ib_logfile0 and ib_logfile1) so you may restore your data in case it is lost:
Follow below steps:
Login to server via SSH with root access.
Navigate to /var/lib/mysql.
If you see files like, ib_logfile0 and ib_logfile1, rename or move them to some other folder.
Stop and start the MySQL service by running sudo service mysql stop and sudo service mysql start
These files will be recreated after you restart the server and the issue will be fixed hopefully.
Thanks
I have the same problems, this my solution:
Add more RAM to the server
Decrease the value of innodb-buffer-pool size in the config file:
sudo nano /etc/mysql/my.cnf
innodb_buffer_pool_size = 10M
After save /etc/mysql/my.cnf.
Restart mysql service:
sudo service mysql restart
exit
This is frequently occurred issue. Do following -
delete/move out these "aria_log_contro, ib_logfile0, ib_logfile1, ib_data1" files from location "..\xampp\mysql\data" and also from "..\xampp\mysql\backup".
stop and start apache server and mysql form xampp control panel
This should fix the issue; actually it worked for me.
NOTE: THIS IS GOING TO RESET THE DB IN MANY CASES BE VERY CAREFUL
Changing the values of innodb_buffer_pool_size and innodb_log_file_size didn't work for me.
Moving ib_logfile0 and ib_logfile1 files didn't help either.
What did help was:
> service mysql stop
Edit my.cfg and add innodb_force_recovery = 1
> service mysql start
> service mysql stop
Comment the innodb_force_recovery = 1 line.
> service mysql start
And voilá. (I should note that I have no idea if this involves any data loss or not)
Although late but putting answer here so that solution that helped me can help someone. I took following steps:
Added more RAM to sever
Decrease the value of innodb-buffer-pool size
Set innodb_log_file_size
Restart mysql
Example of addition to my.cnf:
innodb_buffer_pool_size = 10M
innodb_log_file_size = 1000M
After few unsuccess hours, i checked the disk space... and was full...
I was getting below mysql error log:-
[Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Using Linux native AIO
InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
InnoDB: Completed initialization of buffer pool
InnoDB: Fatal error: cannot allocate memory for the buffer pool
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting
[Note] /usr/libexec/mysqld: Shutdown complete
I found out there are two solutions which are:-
1)Set innodb_log_file_size equal to the actual size of the existing InnoDB log files.
To see what size of innoDB log allocated, login mysql and enter following cmd:-
SHOW GLOBAL VARIABLES LIKE 'innodb_log_file_size';
Expected result example:- 5242880
After that, insert that value in my.cnf:-
vi /etc/my.cnf
innodb_log_file_size =5242880
2)Rename or move both the ./ib_logfile0 and ./ib_logfile1 files, and then start the MySQL server.This normally will be located at /var/lib/mysql. After start mysql, it create new innoDB log file and restore possible half-written data from the file of .ibd.
The expexted mysql log example:-
InnoDB: Database physically writes the file full: wait...
161216 9:58:54 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
161216 9:58:54 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
161216 9:58:54 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
161216 9:58:54 InnoDB: Waiting for the background threads to start
161216 9:58:55 InnoDB: 5.5.50 started; log sequence number 1589772
161216 9:58:55 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
161216 9:58:55 [Note] - '0.0.0.0' resolves to '0.0.0.0';
161216 9:58:55 [Note] Server socket created on IP: '0.0.0.0'.
161216 9:58:55 [Note] Event Scheduler: Loaded 0 events
161216 9:58:55 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.50' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL) by Remi
References:-
JUSTIN KULESZA (2011). MySQL: Failed Registration of InnoDB as a Storage Engine. Available at: https://spin.atomicobject.com/2011/05/09/mysql-failed-registration-of-innodb-as-a-storage-engine/.
RolandoMySQLDBA (2014). MySQL my.cnf: innodb_log_file_size is missing. Available at: https://dba.stackexchange.com/questions/75688/mysql-my-cnf-innodb-log-file-size-is-missing/158325#158325
Changing the Number or Size of InnoDB Redo Log Files. Available at: http://dev.mysql.com/doc/refman/5.7/en/innodb-data-log-reconfiguration.html
Nothing was working with reinstalls, removes, and others (I had no data to keep, not a fix; more of a data destruction process, big caveat there):
1005 mysql_install_db
1007 /usr/bin/mysqld_safe --datadir='/var/lib/mysql
1008 /usr/bin/mysqld_safe --datadir='/var/lib/mysql' (^z)
1009 bg
1010 mysql
1011 mysql_secure_installation
1012 mysql
1013 mysql -p
And viola; actually usable database.
for me the solution was to change the config to add
innodb_use_native_aio = 0
in mysql config
Just move this log file (ib_logfile0) to some other place for safer side and start the mysql services it worked for me.
I also met the same issue when restore a backup set made via innobackupex to a new instance. Finally ,the root cause is innodb_log_file_size doesn't match original instance that take the backup, and fix steps by steps like below:
Get innodb_log_file_size value from oragin instance via below command:
mysql uroot -ppasswd -NBe "show global variables like 'innodb_log_file_size';"
Modify the /etc/my.cnf of new instance with last get value:
vim /etc/my.cnf
Restart mysqld via :
systemctl restart mysqld

Mysql problem: no mysql.sock

Yesterday I was working using MySQL installed on my computer.
I downloaded xampp, so I have I changed on my.cnf file the path to the socket:
/opt/lampp/var/mysql/mysql.sock
That file was just there. Today I wanted to keep working on it, and I found that file is not there anymore, so I am getting the following error while I am starting mysql server:
ERROR 2002 (HY000):
Can't connect to local MySQL server through socket
'/opt/lampp/var/mysql/mysql.sock' (2)
Here are some tests I made:
mujeresponja#ubuntu:~$ ps -fea | grep mysqld
1000 15707 15615 0 16:28 pts/1 00:00:00 grep --color=auto mysqld
mujeresponja#ubuntu:~$ ps -fea | grep mysql
1000 15709 15615 0 16:29 pts/1 00:00:00 grep --color=auto mysql
As a possible solution I uninstalled xampp and reinstall it, and also a new MySQL server, just in case. Anyway, that file is not there anymore.
EDIT
Where the mysql.sock should be, instead there are two files mysql_upgrade_info (Which contains just 5.5.8) and another binary file called ubuntu.err:
mujeresponja#ubuntu:/opt/lampp/var/mysql$ sudo cat ubuntu.err
110403 17:28:52 mysqld_safe Starting mysqld daemon with databases from /opt/lampp/var/mysql
110403 17:28:52 [Note] Plugin 'FEDERATED' is disabled.
/opt/lampp/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110403 17:28:52 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: Compressed tables use zlib 1.2.3
110403 17:28:52 InnoDB: Initializing buffer pool, size = 16.0M
110403 17:28:52 InnoDB: Completed initialization of buffer pool
110403 17:28:52 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name /opt/lampp/var/mysql/ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
110403 17:28:52 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/ubuntu.pid ended
110403 17:29:22 mysqld_safe Starting mysqld daemon with databases from /opt/lampp/var/mysql
110403 17:29:22 [Note] Plugin 'FEDERATED' is disabled.
/opt/lampp/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110403 17:29:22 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: Compressed tables use zlib 1.2.3
110403 17:29:22 InnoDB: Initializing buffer pool, size = 16.0M
110403 17:29:22 InnoDB: Completed initialization of buffer pool
110403 17:29:22 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name /opt/lampp/var/mysql/ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
110403 17:29:22 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/ubuntu.pid ended
(Sorry, I don't know how to show terminal messages in an appropiuate way)
Can anybody help me on this? Thanks in advance!
You can locate the actual socket file and create a symbolic link leading to it as follows:
# check path to socket from mysql settings
mysqladmin | grep d.sock
# create a symbolic link
ln -s path_to_mysql_socket /opt/lampp/var/mysql/mysql.sock
Although the test you did is a bit garbled, Im going to assume that the test just prove mysql isnt running.
Depending on how the mysql configured itself there should be a startup file somewhere, usually around the /etc/rc.* directories, and you would need to run the rc.mysql start (or it could be a S<nn>MySQL in an rc3.d directory for example
I didn't find a certain reason for my problem.
I just unisntalled and reinstalled, and then everything went Ok.
That is not a real solution, but it worked. Good luck
I came in the same situation when I made a grant to *.* to other user. Mysql tried to give permissions over the mysql database and that provoked the disaster: instantly, the mysql.sock file disappeared.
this happened with the version 5.6
I had the same problem with you, and I found some useful information:
2015-08-14 10:51:17 30934 [ERROR] InnoDB: Unable to lock /opt/lampp/var/mysql/ibdata1, error: 11
2015-08-14 10:51:17 30934 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
So, I rebooted the computer and restarted XAMPP, and the problem was resolved.