Fail to stop mysql (Unable to lock ./ibdata1, error: 11) [closed] - mysql

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Since two days, I can't connect to mysql with my root account.
I have no problem to log in with the other accounts.
I first thought my server was hacked and that somebody changed the password. I tried to reset it. To do so, I had to use mysqld_safe and therefore to stop mysql, that I failed to do:
> sudo /etc/init.d/mysql stop
Stopping MySQL database server: mysqld failed!
> mysqld stop
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
130107 13:48:34 InnoDB: Unable to open the first data file
[...]
InnoDB: Error in opening ./ibdata1
130107 13:48:34 InnoDB: Operating system error number 11 in a file operation.
InnoDB: Error number 11 means 'Resource temporarily unavailable'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.1/...ror-codes.html
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
130107 13:48:34 [ERROR] Plugin 'InnoDB' init function returned error.
130107 13:48:34 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
mysqld: Too many arguments (first extra is 'stop').
MySQL couldn't read ibdata1, so I check its permissions that looks correct:
> ls -l /var/lib/mysql/
-rw-rw---- 1 mysql mysql 18874368 Jan 7 12:39 ibdata1
-rw-rw---- 1 mysql mysql 5242880 Jan 7 13:05 ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 Jan 7 13:05 ib_logfile1
I tried to move and copy the file like explained here, without any success:
> mv /var/lib/mysql/ibdata1 /var/lib/mysql/ibdata1.bak
> cp -a /var/lib/mysql/ibdata1.bak /var/lib/mysql/ibdata1
Here is a part of my.cnf
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
LANGUAGE = /usr/share/mysql/english
skip-external-locking
The datadir is correct.
As well, here is what happens when I try to get MySQL status:
# sudo /etc/init.d/mysql status
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'debian-sys-maint'#'localhost' (using password: YES)'
I found a solution to this problem on this page, but I have to log in as a root user to do so, that I can't do. I guess the two problems are linked.
Does anyone of you knows how to fix this? I'm blocked in my work because of this.
Thank you a lot for reading this message and maybe to reply to it.
Have a nice day!

Related

Mysql doesn´t start after expending data-dir with simlink to another database

I´ve installed mysql and it worked fine.
Now I´d liked to have the data of several databases in my dropbox. So I put symlinks in my mysql data dir.
sudo ln -s /Users/michaelbenker/Dropbox/geschaeft/softwareentwicklung/DB/testdatabase /usr/local/mysql/data/testdatabase
Now when I tried to restart mysql, I get the error
ERROR! MySQL server PID file could not be found!
Starting MySQL
. ERROR! The server quit without updating PID file
(/usr/local/mysql/data/Michaels-iMac-783.local.pid).
In my error file I found this entry
2017-05-26T11:29:12.067923Z 0 [ERROR] InnoDB: Operating system error
number 13 in a file operation.
2017-05-26T11:29:12.067928Z 0 [ERROR] InnoDB: The error means mysqld
does not have the access rights to the directory.
2017-05-26T11:29:12.067934Z 0 [ERROR] InnoDB:
os_file_readdir_next_file() returned -1 in directory ./, crash recovery
may have failed for some .ibd files!
2017-05-26T11:29:12.067963Z 0 [ERROR] InnoDB: Plugin initialization
aborted with error Generic error
2017-05-26T11:29:12.375057Z 0 [ERROR] Plugin 'InnoDB' init function
returned error.
2017-05-26T11:29:12.375090Z 0 [ERROR] Plugin 'InnoDB' registration as a
STORAGE ENGINE failed.
2017-05-26T11:29:12.375097Z 0 [ERROR] Failed to initialize plugins.
2017-05-26T11:29:12.375100Z 0 [ERROR] Aborting
So I tried several things to change the permission to my Dropbox data-dir
I tried to change the owner to mysql (tried also _mysql)
I tried to change the group to mysql (tried also _mysql)
I tried to change the chmod to 777
Nothing helped.
I did the same on my MacBook and here everything worked fine.
Here the actual permissions on the Dropbox Dir
drwxrwxrwx# 5 _mysql _mysql 170 26 Mai 13:02 DB
MySQL will also need to be able to change into the parents of the Dropbox directory, which implies a +x on each one.

MYSQL Command Startup Error

I ran this command:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
from terminal without fully understanding it like a dummy (trying to get mysql server to start automatically on boot) and know I can't access mysql at all.
I get this error:
2016-01-11 17:26:52 551 [ERROR] InnoDB: Unable to lock ./ibdata1,
error: 35
2016-01-11 17:26:52 551 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
Can someone explain what I did?
This issue is not related to the executed command. What you did is creating soft/symbolic links (something like shortcut) to plist files that are used to manage MySQL services. You can simply use unlink command to unlink them (It's not recommended unless you know which file can be unlinked without any side effects).
So your question is answered here.

The server quit without updating PID file '

I use the command:
/usr/local/Cellar/mysql/5.6.26/support-files/mysql.server start
to start the database and get the error info:
ERROR! The server quit without updating PID file(/usr/local/var/mysql/macbooks-MacBook-Pro.local.pid).
The local.err has the following information:
151103 20:43:37 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2015-11-03 20:43:37 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-11-03 20:43:37 0 [Note] /usr/local/Cellar/mysql/5.6.26/bin/mysqld (mysqld 5.6.26) starting as process 42772 ...
2015-11-03 20:43:37 42772 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2015-11-03 20:43:37 42772 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/Cellar/mysql/5.6.26/bin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13 - Permission denied)
2015-11-03 20:43:37 42772 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
Your MySQL installation appears to be damaged. You have an error but the proposed resolution isn't likely to help:
/usr/local/Cellar/mysql/5.6.26/bin/mysqld: Can't find file: './mysql /plugin.frm'
(errno: 13 - Permission denied)
2015-11-03 20:43:37 42772 [ERROR] Can't open the mysql.plugin table.
Please run mysql_upgrade to create it.
As you see, MySQL cannot open a file, but not because it does not exist; rather because it has no rights to do so (error 13).
From the console, verify the status of the mysql/plugin.frm file in the 'mysql' directory. You'll need to find the MySQL data directory (mysql).
Supposing it's /usr/local/var/mysql/, you would do
ls -la /usr/local/var/mysql/ | more
(SPACE or ENTER to page the output) and see a row containing "plugin.frm".
If there is not, then running the mysql_upgrade command might fix things (but backup the mysql installation and data directory first! Just in case).
If there is, verify it has the same user and group as the other files. Chances are that the other files will be owned by Cellar/users and this, maybe, by root/wheel. As administrator (su), try running
chown Cellar:users ./mysql/plugin.frm
and this should fix the Errno 13, and possibly the PID trouble as well.
Failing everything else, reinstalling MySQL could be a solution. You'll install the same version 5.6.26, then verify the data directory and, if necessary, overwrite it with your backup, having care to preserve the new ownerships and permissions.
This trick isn't guaranteed to work between different MySQL versions and OSes, but on the same machine with the same MySQL version and OS it stands excellent chances.
You can also run a partial restore of only the databases you need (for example you can skip restoring the mysql tablespace where all users and permissions are. You'll lose them, but the data will still be accessible in the other databases).

XAMPP - Error: MySQL shutdown unexpectedly

I have reinstalled XAMPP for some reason and MySQL is not working, giving the following error in the console:
01:56:03 [mysql] Error: MySQL shutdown unexpectedly.
01:56:03 [mysql] This may be due to a blocked port, missing dependencies,
01:56:03 [mysql] improper privileges, a crash, or a shutdown by another method.
01:56:03 [mysql] Check the "/xampp/mysql/data/mysql_error.log" file
01:56:03 [mysql] and the Windows Event Viewer for more clues
When checking the "/xampp/mysql/data/mysql_error.log" file I get:
130302 1:48:06 InnoDB: Waiting for the background threads to start
130302 1:48:07 InnoDB: 1.1.8 started; log sequence number 1600324627
130302 1:48:07 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
130302 1:48:07 [Note] - '0.0.0.0' resolves to '0.0.0.0';
130302 1:48:07 [Note] Server socket created on IP: '0.0.0.0'.
130302 1:51:12 [Note] Plugin 'FEDERATED' is disabled.
130302 1:51:12 InnoDB: The InnoDB memory heap is disabled
130302 1:51:12 InnoDB: Mutexes and rw_locks use Windows interlocked functions
130302 1:51:12 InnoDB: Compressed tables use zlib 1.2.3
130302 1:51:12 InnoDB: Initializing buffer pool, size = 16.0M
130302 1:51:12 InnoDB: Completed initialization of buffer pool
130302 1:51:12 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!
130302 1:51:12 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...
130302 1:51:13 InnoDB: Waiting for the background threads to start
130302 1:51:14 InnoDB: 1.1.8 started; log sequence number 1600324627
130302 1:51:14 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
130302 1:51:14 [Note] - '0.0.0.0' resolves to '0.0.0.0';
130302 1:51:14 [Note] Server socket created on IP: '0.0.0.0'.
130302 1:56:01 [Note] Plugin 'FEDERATED' is disabled.
130302 1:56:01 InnoDB: The InnoDB memory heap is disabled
130302 1:56:01 InnoDB: Mutexes and rw_locks use Windows interlocked functions
130302 1:56:01 InnoDB: Compressed tables use zlib 1.2.3
130302 1:56:01 InnoDB: Initializing buffer pool, size = 16.0M
130302 1:56:01 InnoDB: Completed initialization of buffer pool
130302 1:56:01 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!
130302 1:56:01 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...
130302 1:56:02 InnoDB: Waiting for the background threads to start
130302 1:56:03 InnoDB: 1.1.8 started; log sequence number 1600324627
130302 1:56:03 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
130302 1:56:03 [Note] - '0.0.0.0' resolves to '0.0.0.0';
130302 1:56:03 [Note] Server socket created on IP: '0.0.0.0'.
That is just a part of the log, the full one is a bit too big.
Help?
Make sure you backup the mentioned folders before taking any action!
This worked for me,
Quit the XAMPP
Cut all files in C:\xampp\mysql\backup
Paste and replace files into C:\xampp\mysql\data
Run the XAMPP as administrator
In my case, I did two things:
moved xampp/mysql/backup files into xampp/mysql/data
RUN XAMPP as Administrator
It worked for me :)
First you need to keep copy of following somewhere in your hard disk.
C:\xampp\mysql\backup
C:\xampp\mysql\data
After that
Copy every thing inside "C:\xampp\mysql\backup" and paste and replace it in
"C:\xampp\mysql\data"
Now your mysql will work in phpmyadmin but your tables will show "Table not found in engine"
For this you will have to go to the copy of "backup and data folders"
which have created in your hard disk and there in the data folder copy
"ibdata1" file and past and replace in the "C:\xampp\mysql\data".
Now your tables data will be available.
Caution! Don't delete ibdata1 file!
Just follow these steps and its done.
Rename the folder C:\xampp\mysql\data to C:\xampp\mysql\data_old (you can use any name)
Create a new folder C:\xampp\mysql\data
Copy the content that resides in C:\xampp\mysql\backup to the new C:\xampp\mysql\data folder
Copy all your database folders that are in C:\xampp\mysql\data_old to C:\xampp\mysql\data (skip the mysql, performance_schema, and phpmyadmin folders from C:\xampp\mysql\data_old)
Finally copy the ibdata1 file from C:\xampp\mysql\data_old and replace it inside C:\xampp\mysql\data folder
Now Start MySQL from XAMPP control panel
And its all done, Enjoy...
If your skype is open, Quit skype and try,
or
Go to your xampp/wamp installed, search for httpd.conf.
Open that file using textpad/notepad, search for Listen or 80 ,
update listen port to 8081 and save the file.
Restart xampp/wamp, start the servers.
or follow below steps in skype
Rename the folder mysql/data to mysql/data_old (you can use any name)
Create a new folder mysql/data Copy the content that resides in mysql/backup to the new mysql/data folder
Copy all your database folders that are in mysql/data_old to mysql/data (skipping the mysql, performance_schema, and phpmyadmin folders from data_old)
Finally copy the ibdata1 file from mysql/data_old and replace it inside the mysql/data folder
Start MySQL from the XAMPP control panel
If Apache is running without any issue , and u find some blockage by system security settings , simply allow it instead of blocking or closing the dialog box.
And change the port number for MySQL to 3607 as it was before 3606 .
It worked for me .
To resolve this,
Go to your XAMPP folder,
XAMPP -> mysql -> bin -> "my.ini"
After opening my.ini configuration file, Replace 3306 with 3308 in couple of places, because 3308 is a free port.
XAMPP -> php -> "php.ini"
Do the same as you did in "my.ini" file which is changing port 3306 to 3308.
Then, restart the XAMPP server.
It works fine.
There may be MySQL server installed previously in your computer try to uninstall that and start MySQL at the XAMPP This solved mine
the true way is RECONFIGURE your app.with setup of MYSQL .you can open your setup again and change port from 3306 to 3307.
I would simply try reinstalling XAMPP.
one reason I found ( and not mentioned in addition to other answers given in this site on the similar problem ) was by going to task manager in windows and stopping the mysqld which was running already and prevented mysql server from starting.
You must:
Close the xampp
Go to the folder where you installed it, if in (c:) may be something like C:\xampp\ , access folder C:\xampp\mysql\data
Delete the file ibdata1
Starts XAMPP again.
The best solution for this problem is just open your mysql configuration directive file my.ini present inside the folder C:\xampp\mysql\bin and change the information related to the ports, usually some programs occupy the port no. 3306 as a result of that it stops working, Now you follow two steps to make it working.
enter code here
Step-1. Search for ['client'], you can see some thing like this
[client]
# password = your_password
port = 3306
socket = "C:/xampp/mysql/mysql.sock"
Now in the port section remove 3306 and add port = 3306 > 3307 as shown below.
[client]
# password = your_password
port = 3306 > 3307
socket = "C:/xampp/mysql/mysql.sock"
Step -2. Similarly Search for ['mysqld'], you can see something like this
[mysqld]
port= 3306
socket = "C:/xampp/mysql/mysql.sock"
basedir = "C:/xampp/mysql"
tmpdir = "C:/xampp/tmp"
datadir = "C:/xampp/mysql/data"
pid_file = "mysql.pid"
# enable-named-pipe
key_buffer = 16M
max_allowed_packet = 1M
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error = "mysql_error.log"
Now here change the port number 3306 to 3307 and add a line "innodb_force_recovery = 1" exactly as shown below.
[mysqld]
port= 3307
socket = "C:/xampp/mysql/mysql.sock"
basedir = "C:/xampp/mysql"
tmpdir = "C:/xampp/tmp"
datadir = "C:/xampp/mysql/data"
pid_file = "mysql.pid"
# enable-named-pipe
key_buffer = 16M
max_allowed_packet = 1M
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error = "mysql_error.log"
innodb_force_recovery = 1
Thats it, restart you mysql service, it will work for sure.
For anyone that searched and pressed on this link, i solved it by simply searching for mysql notifier and stop mysql from running there, Then run mysql in xampp again and it runs. why this works ? iam not expert, but i think it is easy : port was taken already by mysql notifier so had to stop it there and run it here.
I am new to XAMPP, but I find that a combination of these suggestions works best (At least on Windows 8.1 with the latest version of XAMPP. Note that the computer I tested this on, also had skype).
First logon to skype and navigate to "Tools < Options < Advanced < Connection."
Then check the box that says "Use port 80 and 443 for additional incoming connections." Save, close, and quit skype.
Next, on your XAMPP control panel, click "config < my.ini" and change lines 19 and 27 (should have port = 3306) from "3306" to "3307."
Also, you will need to navigate to xampp < phpMyAdmin < config.inc and change line 27, which should like something like this:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
You will need to add "3307" as follows:
$cfg['Servers'][$i]['host'] = '127.0.0.1:3307';
Now, open your browser and you should see the xampp page when you type in "localhost."
Additionally, if this is your first time using xampp, you may see a warning about your lack of password (highlighted in pink) on your localhost/phpmyadmin/ page. This is easily remedied by going to the "user accounts" tab in phpmyadmin, clicking on "edit privileges" and entering password. Remember to save the hashed version of any and all passwords you create as we will use this next! -I opened a notepad and saved (and numbered) them. Note that phpMyadmin will notify you of when you are changing the password for your current session (this will be displayed at the top of your phpMyadmin page and is very important, as you will need THAT specific hashed version of your password).
Next, you will need to navigate to the following location "xampp < phpMyAdmin < config.inc" on your computer and open and edit the file with a text editor. You will want to put in the hashed version of your password between the single quotes for password and change "AllowNoPassword" from true to false.
And, that ought to do it.
In my case :
I have just replaced
....xampp/mysql/backup files
into
**xampp/mysql/data**
It worked for me.
if you inistalled mysql Independently
you can stop mysql service if running
no one of these answers are worked for me
this work for me
Well first thing ,, I know its late so I dont know if anyone will upvote it but oh well its okay,,
secondly, uninstalling xampp might not do you any good because the process using the port 3306 (Mysql's default port) will still be running somewhere on your system. might be skype, but might not be skype.
so the best way would be to find out which process is using port 3306, and then terminate the process.
so to find out which process is using port 3306, open command prompt, and type
netstat -n -o -a
you will get a screen like
this.
Then look for the address with port number 3306
and find out the PID corresponding to that.
Then simply open a command prompt as administrator and type
taskkill /F /PID 1234
replace 1234 with your respective PID.
Then you can try starting mysql and it will work.
And now if you are lazy to do this step all over again when restarting the computer,,,
you can simply use the following batch script to terminate the process automatically and enjoy :)
#echo off
setlocal enableextensions
set "port=3306"
for /f "tokens=1,4,5" %%a in (
'netstat -aon ^| findstr /r /c:"[TU][CD]P[^[]*\[::\]:%port%"'
) do if "%%a"=="UDP" (taskkill /F /PID %%b) else (taskkill /f /PID %%c)
endlocal
pause
save it as anything.bat and run it everytime you want to use mysql. :)
**
-> "xampp->mysql->data" cut all files from data folder and paste to another folder
-> now restart mysql
-> paste all folders from your folder to myslq->data folder
and also paste ib_logfile0.ib_logfile1 , ibdata1 into data folder from your folder.
your database and your data is now available in phpmyadmin..**
I did all methods but didn't find the perfect solution!
Install Laragon instead of Xampp , You will pray for me.
In my case I had to go to C:\xampp\mysql\data and delete all files (not folders) but keep ibdata1 and my.ini. Restartet XAMPP, everything running again.
Hope that helps someone - had to look for hours before finding that!
just run your xammp as an administrator, it works

MySQL won't start in CentOS 5.5 and the "ERROR 2002"

I would like to ask a help for the problem I encountered. My mysql server suddenly stopped after I install php-soap. I don't know why it get stopped actually...
Since it's stopped I tried to start it by typing the line:
# /etc/init.d/mysqld start
After this, I get this message:
MySQL Daemon failed to start.
Starting mysqld: [FAILED]
Starting mysql seems failed. Since I tried it numerous times and got this result a numerous time. I checked the mysqlog and here's what I got.
==== MYSQL LOG ====
120511 21:34:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120511 21:34:43 [ERROR] Error message file '/usr/share/mysql/english/errmsg.sys' had only 481 error messages,
but it should contain at least 641 error messages.
Check that the above file is the right version for this program!
/usr/libexec/mysqld: Unknown error 1146
120511 21:34:43 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120511 21:34:43 InnoDB: Initializing buffer pool, size = 8.0M
120511 21:34:44 InnoDB: Completed initialization of buffer pool
120511 21:34:44 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: 'open'.
InnoDB: Cannot continue operation.
120511 21:34:44 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Other infos:
OS: CentOS 5.5 64bit
Mysql Version: Sorry I couldn't get the version of mysql installed on my server due this error I am getting:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Can somebody help me to resolve this problem?
Thank you in advanced.
looks like your installation of mysql is not corrupt with /usr/share/mysql/english/errmsg.sys having been modified to contain less than the number of entries needed.
i would get the installation/src files for mysql for your centos box again. Untar it and locate the file errmsg.sys from sql/share/english, copy it to /usr/share/mysql/english/errmsg.sys and restart your mysqld. Another option is just to reinstall mysql from centos repo, after backing up your dbs to make sure they don't get blown away and to have a copy/backup of it.
I would also find out what made the changes to the errmsg.sys file.