XAMPP - Error: MySQL shutdown unexpectedly - mysql

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

Related

How repair corrupt xampp 'mysql.user' table?

I used Xampp yesterday to create some simple Web-based utility tool.
Today I wanted to continue working on it but xampp control panel gave me some weir errors.
This is the MySQL Error Log:
2019-07-20 23:47:13 0 [Note] InnoDB: Uses event mutexes
2019-07-20 23:47:13 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-07-20 23:47:13 0 [Note] InnoDB: Number of pools: 1
2019-07-20 23:47:13 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-07-20 23:47:13 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2019-07-20 23:47:13 0 [Note] InnoDB: Completed initialization of buffer pool
2019-07-20 23:47:13 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=1819402
2019-07-20 23:47:14 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-07-20 23:47:14 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2019-07-20 23:47:14 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-07-20 23:47:14 0 [Note] InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-07-20 23:47:14 0 [Note] InnoDB: File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB.
2019-07-20 23:47:14 0 [Note] InnoDB: Waiting for purge to start
2019-07-20 23:47:14 0 [Note] InnoDB: 10.3.16 started; log sequence number 1819411; transaction id 257
2019-07-20 23:47:14 0 [Note] InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
2019-07-20 23:47:14 0 [Note] InnoDB: Buffer pool(s) load completed at 190720 23:47:14
2019-07-20 23:47:14 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-07-20 23:47:14 0 [Note] Server socket created on IP: '127.0.0.1'.
2019-07-20 23:47:14 0 [ERROR] mysqld.exe: Table '.\mysql\user' is marked as crashed and should be repaired
2019-07-20 23:47:14 0 [ERROR] mysqld.exe: Index for table '.\mysql\user' is corrupt; try to repair it
2019-07-20 23:47:14 0 [ERROR] Couldn't repair table: mysql.user
2019-07-20 23:47:14 0 [ERROR] Fatal error: Can't open and lock privilege tables: Index for table 'user' is corrupt; try to repair it
Tried already to repair, but the mySQL Service won't even start, so I'm kinda helpless...
This is almost certainly a known bug in mariaDB (ie mySQL). See ApacheFriends.org for the description. Problem occurs after user password changes - often user root.
General advice seems to be to cut your losses and downgrade your XAMPP to 7.3.5
Otherwise the problem may later recur even after a complete uninstall/re-install of 7.3.7 for example.
What follows is a circumvention / repair for Windows/XAMPP users. It assumes you have a backup - which you probably do. (It appears the installation process provides an initial backup.) Idea is to get you back on air without downgrading long enough for the next release to arrive.
Quickest way out of the swamp is just to go to step 9.
(1) Find 'my.ini' (eg. c:\xampp\mysql\bin\my.ini )
(2) Insert 'skip-grant-tables' in a new line following label '[mysqld]'. Remove this later.
(3) Now mySQL can be started from the XAMPP control panel.
(4) Start phpMyAdmin from browser and select table 'user' from database 'mysql'
(5) Should see: #1034 Index for table 'user' is corrupt; try to repair it.
(6) Select 'mysql' from left panel then check 'user' in right hand panel.
(7) From the 'With selected' dropdown run 'analyze' then 'repair table'.
(8) If 'Repair' fails no choice but to 'DROP TABLE user' ....
(9) Recreate 'user' table from the distribution backup by copying the following 3 files.
C:\xampp\mysql\backup\mysql\user.frm
C:\xampp\mysql\backup\mysql\user.MYD
C:\xampp\mysql\backup\mysql\user.MYI
to
C:\xampp\mysql\data\mysql\
then restarting XAMPP and adding/removing/editing users as you wish.
One last point: There seems to be some sort of association between the 'user' and 'db' tables. You may need to repair the 'db' table as per step (7).
Use bellow command and you will be happy as i am now.
repair table DATABASENAME.TABLENAME use_frm;
I'm sure you know that you should change capitals with your storage preferences and backup before runing this command, don't you? :)
I had problem #1034-Index for table 'db' is Corrupt; try to repair it in phpmyadmin
Step:1
Run these two queries for the damaged table:
REPAIR TABLE mysql.db
REPAIR TABLE mysql.user
Step:2 follow image below:
Check the corrupt tables and then click on the dropdown beside Check all and from the dropdown list select Repair table from the Table Maintenance group.
Just use
REPAIR TABLE mysql.user
For windows:
Go to Xampp folder:
Xampp->mysql->bin
Double click on: mysql_upgrade.exe
after that refresh your browser(phpmyadmin)
The easiest way
Checked that corrupt table and then select/click on Repair table.
try this i hope it will work.
I also encountered this 'bozo' error under XAMPP, version 7.3.16, so I'll be sure NOT to upgrade anytime soon. I use SQLYog to manage my database, so I was able to repair the specific table listed in the error -- mysql.db . I don't know what the command line version of this would be, but here is a screenshot of the options I checked in SQLYog:
Run these two queries:
CHECK TABLE `users`
and
CHECK TABLE `db`
Run the following query for the damaged table
REPAIR TABLE `users`
and/or
REPAIR TABLE `db`
This worked for me, fixed issues with user accounts
repair table mysql.db use_frm
in xampp
localhost/phpmyadmin
here select db as mysql
then run
repair table global_priv;
I had the problem 1034 after changing the password for root user.
I had queried the following in the console at the bottom left of the phpMyAdmin page.
REPAIR TABLE mysql.db
REPAIR TABLE mysql.user
mysql.user is not a table, is a view, thats why cant be repair. Dont worry about it, just fix all the other tables in mysql
Adding the following worked for me.
skip-grant-tables
But after restoring use from the backup folder to data and then removing skip-grant-table again results in MySQL not starting.
I could not get MySQL to run. It kept exiting out. So I wasn't able to run any of the queries others suggested. However, my solution seemed a bit easier for me. I copied the three main db backup files, your root install location may differ, but mine were located at C:\xampp\mysql\backup\mysql.
db.frm
db.MAD
db.MAI
Always backup your files first. Then I copied these files into the data directory overwriting the corrupt files, C:\xampp\mysql\data\mysql.
Once I did this, I was able to start up MySQL perfectly with no errors.
Stop mysql then open my.cnf or my.ini then add
skip-grant-tables
Please copy user table from original (fresh) MySQL:
[path_data]\mysql\user.frm
[path_data]\mysql\user.MYD
[path_data]\mysql\user.MYI
Then running mysql_upgrade
$ mysql_secure_installation
Then follow instruction
This step for me on Laragon (Windows).
select mysql database and run the below command. It worked.
REPAIR TABLE global_priv
I got the same error on Xampp and solved with mysql_upgrade.exe .
Background: I imported a new db in adminer, tried to create a user for that db and got the problem. The db I was trying to import was a dump created with phpmyadmin.
What I did: I executed (from git bash, I'm on Windows 10):
/c/xampp/mysql/bin/mysql_upgrade.exe -u root -p
from the output of this execution I saw several phases with no error but same views of a DB that I imported some time ago, don't have a valid user (I got:
...
Phase 3/7: Fixing views
...
The user specified as a definer ('xxx'#'%') does not exist
...
At the end of this execution I tried to create a user and it worked fine.
Late from the party, but if repair fails, be sure that the user table is an actual table instead of a view. In latter case, you can try to repair with
REPAIR VIEW user;
For windows:
Make sure, your Apache and MySQL keep running.
Go to Xampp folder: Xampp->mysql->bin
Double click on: mysql_upgrade.exe
after that refresh your browser(phpmyadmin)
THIS IS PROVEN AND TESTED
Step 1. In your XAMPP installation directory find the " \phpMyAdmin\libraries\ "
Step 2. In above folder, find this file > " check_user_privileges.inc.php "
Step 3. Open above file in a code editor of your choice and find line number 28
" $checkUserPrivileges->analyseShowGrant(); "
Step 4. Delete Line Number 28 and add below code instead:
$GLOBALS['is_create_db_priv'] = true;
$GLOBALS['is_reload_priv'] = true;
$GLOBALS['db_to_create'] = '';
$GLOBALS['dbs_where_create_table_allowed'] = array('*');
$GLOBALS['dbs_to_test'] = false;
$GLOBALS['db_priv'] = true;
$GLOBALS['col_priv'] = true;
$GLOBALS['table_priv'] = true;
$GLOBALS['proc_priv'] = true;
Step 5. Save file and restart XAMPP.

XAMPP OS X MariaDB datadir changed: mysql does not start

I downloaded XAMPP for OS X 5.6.14 for OS X that includes MariaDB.
Now I want to change the datadir from the database but that does not work. If I start mysql the lights from XAMPP controls are red but the service "mysql" is running...
my.cnf looks like this:
[client]
socket = /Users/tobias/Documents/Webserver/mysql/mysql.sock
[mysqld]
socket = /Users/tobias/Documents/Webserver/mysql/mysql.sock
datadir = /Users/tobias/Documents/Webserver/mysql/
innodb_data_home_dir = /Users/tobias/Documents/Webserver/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /Users/tobias/Documents/Webserver/mysql/
I copied all files from the old directory to the new one and tried to start mysql.
After that, I got this error messages:
2015-12-05 19:50:18 140735225118720 [ERROR] Missing system table mysql.roles_mapping; please run mysql_upgrade to create it
2015-12-05 19:50:18 140735225118720 [ERROR] Incorrect definition of table mysql.event: expected column 'sql_mode' at position 14 to have type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH'), found type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_A
2015-12-05 19:50:18 140735225118720 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
Then I run mysql_upgrade and the errors were gone.
I've got no error in log but database does not start... service is running, but lights in Manager are red. phpmyadmin can not connect to db
Does anybody has an tutorial how I can move mysql database directory to a new one?
Permissions of the new folder is set to mysql:mysql
Thanks!

Mysql database deactivated - Xampp v3.2.1, Windows 8

Yes, I know this question has been asked and answered a dozen times but I have searched and tried all that was suggested and uninstalled and reinstalled like 4 times and still haven't gotten any closer to activating mysql database. It shouldn't be deactivated.
Please help me. I wanted to post pictures which would help in visualizing what is going on but I can't so I will try my best to explain.
xampp control panel: I have apache and mysql service modules ticked.
localhost/xampp status page shows mysql database : deactivated.
localhost/phpmyadmin shows exclamation marks on the databases and 'x' on the server connection collation.
for this question i did check mysql_error.log as suggested by best answer:
2014-08-27 11:18:44 28348 [Note] InnoDB: 5.6.20 started; log sequence number 1665244
2014-08-27 11:18:44 28348 [Note] Server hostname (bind-address): '*'; port: 3306
2014-08-27 11:18:44 28348 [Note] IPv6 is available.
2014-08-27 11:18:44 28348 [Note] - '::' resolves to '::';
2014-08-27 11:18:44 28348 [Note] Server socket created on IP: '::'.
2014-08-27 11:18:45 28348 [Note] Event Scheduler: Loaded 0 events
2014-08-27 11:18:45 28348 [Note] C:\xampp\mysql\bin\mysqld.exe: ready for connections.
Version: '5.6.20' socket: '' port: 3306 MySQL Community Server (GPL)
so port is 3306.
for the answer below the best answer i did run mysql_start.bat:
MySQL is trying to start
Please wait ...
MySQL is starting with mysql\bin\my.ini<console>
[Warning] Using unique option prefix key_buffer instead of key_buffer_size is
deprecated and will be removed in future release. Please use full name instead.
[Warning[ TIMESTAMP with implicit DEFAULT value is deprecated. Please use
--explicit_defaults_for_timestamp server option <see documentation for more details>
MySQL could not be started.
"MySQL could not be started"
for this question i did do the second bullet but it didnt work for me. mysql database status still remianed deactivated.
I wanted to try this blog's suggestions but I couldn't find winmysqladmin.exe
I'm sorry, it must be annoying having this question pop up all the time like spam but I really need help with this. Please and thank you!
EDIT
if i go to 127.0.0.1/phpmyadmin the exclamation marks and x is not there but 127.0.0.1/xampp/ status page still shows mysql database deactivated.
i tested ipv6: it is enabled but i don't have an address for it so i guess ipv4 is what im using. how do i bind it to ipv4 instead of ipv6? do i just disable ipv6?
Attempting to start MySQL service...
Problem detected!
Port 3306 in use by "I:\xampp\mysql\bin\mysqld.exe"!
MySQL WILL NOT start without the configured ports free!
You need to uninstall/disable/reconfigure the blocking application
or reconfigure MySQL and the Control Panel to listen on a different port
Attempting to start MySQL service...

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

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!

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.