How to fix "Error: MySQL shutdown unexpectedly."? - mysql

So when i try to start mysql on xampp i get this error:
Error: MySQL shutdown unexpectedly.
This may be due to a blocked port, missing dependencies,
improper privileges, a crash, or a shutdown by another method.
Press the Logs button to view error logs and check
the Windows Event Viewer for more clues
If you need more help, copy and post this
entire log window on the forums
When I check the loggs it says this:
InnoDB: using atomic writes.
InnoDB: Mutexes and rw_locks use Windows interlocked functions
InnoDB: Uses event mutexes
InnoDB: Compressed tables use zlib 1.2.11
InnoDB: Number of pools: 1
InnoDB: Using SSE2 crc32 instructions
InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
InnoDB: Completed initialization of buffer pool
InnoDB: 128 out of 128 rollback segments are active.
InnoDB: Creating shared tablespace for temporary tables
InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
InnoDB: File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB.
InnoDB: Waiting for purge to start
InnoDB: 10.4.11 started; log sequence number 1157675541; transaction id 297601
InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
Plugin 'FEEDBACK' is disabled.
Server socket created on IP: '::'.
InnoDB: Buffer pool(s) load completed at 201129 14:58:23
How to fix this?

Issue may be due to port blocking
MySql generally starts server on port 3306 which can be used by some other programs like Skype. Ensure you change the port number.
Initially ensure that no program is using port 3306 by starting Task Manager → Services → Check program using port 3306 and terminate (generally it is not related to OS) If the above checking is done then simply open XAMPP Control Panel → MySql config → my.ini → replace port 3306 to 3307 or 3308 (free port). Expand window → Config at right top → Service and port settings → MySql → Main Port → 3307 (assume) → Save Go to XAMPP folder wherever it is installed → htdocs → php → php file (configuration type) → replace port 3306 to 3307 → start the server from control panel and check if it works perfectly fine or not.

Related

I've got this problem all of a sudden with mysql after restart the laptop

When I try to run mysql server on Apache server on application Xampp
this error message appears. I've got this problem all of a sudden.
I tried to change the port of mysql but it did not work.
Error: MySQL shutdown unexpectedly. This may be due to a blocked port,
missing dependencies, improper privileges, a crash, or a shutdown by
another method. Press the Logs button to view error logs and check the
Windows Event Viewer for more clues If you need more help, copy and
post this entire log window on the forums
when I open my sql errors Log i see ..
Mutexes and rw_locks use Windows interlocked functions
Uses event mutexes
Compressed tables use zlib 1.2.11
Number of pools: 1
Using SSE2 crc32 instructions
Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
Completed initialization of buffer pool
128 out of 128 rollback segments are active.
Creating shared tablespace for temporary tables
Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB.
Waiting for purge to start
10.3.16 started; log sequence number 14508144; [enter image description here][1]transaction id 14742
Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
Plugin 'FEEDBACK' is disabled.
Server socket created on IP: '::'.

Error in starting MYSQL in XAMPP

When I start xampp it gives me an error in mysql. I'm using windows 10.
Here is the contents of error log:
2015-11-10 15:26:56 10fc InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2015-11-10 15:26:56 4348 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2015-11-10 15:26:56 4348 [Note] InnoDB: The InnoDB memory heap is disabled
2015-11-10 15:26:56 4348 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-11-10 15:26:56 4348 [Note] InnoDB: Memory barrier is not used
2015-11-10 15:26:56 4348 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-11-10 15:26:56 4348 [Note] InnoDB: Not using CPU crc32 instructions
2015-11-10 15:26:56 4348 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2015-11-10 15:26:56 4348 [Note] InnoDB: Completed initialization of buffer pool
2015-11-10 15:26:56 4348 [Note] InnoDB: Highest supported file format is Barracuda.
2015-11-10 15:26:57 4348 [Note] InnoDB: 128 rollback segment(s) are active.
2015-11-10 15:26:57 4348 [Note] InnoDB: Waiting for purge to start
2015-11-10 15:26:57 4348 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.26-74.0 started; log sequence number 1835027
2015-11-10 15:26:57 6140 [Note] InnoDB: Dumping buffer pool(s) not yet started
2015-11-10 15:26:57 4348 [Note] Plugin 'FEEDBACK' is disabled.
2015-11-10 15:26:57 4348 [Note] Server socket created on IP: '::'.
2015-11-10 15:26:57 4348 [Note] Event Scheduler: Loaded 0 events
2015-11-10 15:26:57 4348 [Note] C:\xampp\mysql\bin\mysqld.exe: ready for connections.
Version: '10.1.8-MariaDB' socket: '' port: 3306 mariadb.org binary distribution
2015-11-10 15:27:11 5152 [Note] C:\xampp\mysql\bin\mysqld.exe: Normal shutdown
When I opened XAMPP and click start MySQL button it gives me an error.
9:12:53 PM [mysql] Error: MySQL shutdown unexpectedly.
9:12:53 PM [mysql] This may be due to a blocked port, missing dependencies,
9:12:53 PM [mysql] improper privileges, a crash, or a shutdown by another method.
9:12:53 PM [mysql] Press the Logs button to view error logs and check
9:12:53 PM [mysql] the Windows Event Viewer for more clues
9:12:53 PM [mysql] If you need more help, copy and post this
9:12:53 PM [mysql] entire log window on the forums
UPDATE
Here is the screenshot:
First: Close Xampp.
Second: Go to \xampp\mysql\backup.
Third: Copy all files in directory except ibdata1.
Fourth: Go to \xampp\mysql\data.
Fifth: Paste the files that you copied from \xampp\mysql\ backup
(Replace the files when asked).
Sixth: Start Xampp.
Follow these steps properly and carefully.
This error is caused because there is already MySQL installed (of different version) which is using port 3306.
On the xampp control panel you will find 'MySQL' and several options like Start, Config, etc beside that.
Select Config and open the file named 'my.ini'. It should open in a notepad. Press Ctrl + F and Find '3306' and change it to 3308 and Save the file.
NOTE: YOU WILL FIND 5 INSTANCES OF 3306. CHANGE ALL OF THEM TO 3308.
Now Open the Config which is located on the top-right of the Xampp control panel. A window should appear. Find 'Service and Port setting'. Click the button and once again a window should appear.
5.On the MySQL tab type '3308'. And Save the changes.
6.Search 'services.msc' on Windows search. A Window should popup. Scroll down until you find 'MySQL'.
Right click on MySQL and select STOP.
Now Run Command Prompt as administrator and type the following command.
sc delete mysql
This will successfully delete previously installed mysql.
Quit the xampp control panel completely and start a new fresh one.
Now your MySQL should be up and running.
Probably your 3306 or whatever you use is being used by other applications. May be you don't know that XAMPP usually has problems with apps like Skype. If you are running Skype try to close it and open XAMPP. You can also change default ports for HTTP and MySQL.
To Edit Apache ports open apache.conf and restart the server.
To Edit MySql ports open my.cnf and restart the service.
You may also take a look to this post. May be you need to delete your DB files due corruption but it may be not the reason if you just installed fresh Xampp instance.
XAMPP - MySQL shutdown unexpectedly
UPDATE
Here you have a good screenshot of how to change ports on Skype if you prefer.
https://stackoverflow.com/a/16351807/3518053
The problem is that you have two instances of mysql installed in your computer. Check if the process mysqld.exe is already running via task manager and terminate it if present. Then open services.msc via run and remove all instances of mysql if any(terminate it before removing), reboot your machine and run XAMPP again. This will solve your problem.
I came across a similar problem, you can try this here
Remember to backup your data first!
Using cmd as administrator uninstall
xampp
all mysql database
mysql service
then remove the service using sc delete and remove all directory of XAMPP. Then reinstall it again.

Error 1067: The process terminated unexpectedly when trying to start MySQL

I have WAMP server version 2.2. Previously, MySQL Server running normally.
I don't know why when I tried to start, it cannot start anymore.
Here are the content of MySQL.log:
140502 21:04:46 [Note] Plugin 'FEDERATED' is disabled.
140502 21:04:47 InnoDB: The InnoDB memory heap is disabled
140502 21:04:47 InnoDB: Mutexes and rw_locks use Windows interlocked functions
140502 21:04:47 InnoDB: Compressed tables use zlib 1.2.3
140502 21:04:47 InnoDB: Initializing buffer pool, size = 128.0M
140502 21:04:47 InnoDB: Completed initialization of buffer pool
140502 21:04:47 InnoDB: highest supported file format is Barracuda.
140502 21:04:47 InnoDB: Waiting for the background threads to start
140502 21:04:48 InnoDB: 1.1.8 started; log sequence number 1595675
140502 21:04:48 [Note] Server hostname (bind-address): '(null)'; port: 3306
140502 21:04:48 [Note] - '(null)' resolves to '::';
140502 21:04:48 [Note] - '(null)' resolves to '0.0.0.0';
140502 21:04:48 [Note] Server socket created on IP: '0.0.0.0'.
140502 21:04:48 [ERROR] Can't start server: Bind on TCP/IP port: No such file or directory
140502 21:04:48 [ERROR] Do you already have another mysqld server running on port: 3306 ?
140502 21:04:48 [ERROR] Aborting
140502 21:04:48 InnoDB: Starting shutdown...
140502 21:04:49 InnoDB: Shutdown completed; log sequence number 1595675
140502 21:04:49 [Note] wampmysqld: Shutdown complete
I had already tried to reinstall WAMP server but appear the same error.
Can someone help me, please...
It's possible that the port is trying to be opened by another storage engine than InnoDB. Refer to this article for some commands that can help you identify what's happening.
For instance, netstat -an | findstr "3306"
danielschneller.com/2007/10/cant-start-server-bind-on-tcpip-port-no.html
Something is already working on that port. In administrator CMD console write
netstat -abn
and find port 3306, then you will know what is blocking the port (what is already running on it and blocks your mysql).
If that doesnt help you then check my.ini settings
In that file search for
socket = /something
and change that to
socket = c:/something
I had the same problem with Windows 7 32-bit.
Cause
Some filenames are reserved by Windows, such as ${machinename}.pid, ${machinename}.err, etc.
MySQL uses some of these filenames by default.
Solution
After the installation is complete, during the configuration phase, there's an Advanced option using which you can change these filenames. You can change the log file names but not the pid file name.
You need to step through the configuration wizard to the "starting service" step, and then it will throw an error/warning message. Leave the wizard paused (do not stop/cancel the wizard).
By now, your my.ini file has been created. You can add the following variable
pid_file=/path/to/pid/file.pid
Then go to Windows Services and start the service.
N.B. DO NOT STOP/CANCEL THE WIZARD.
Once the service is started, the wizard will continue, and will configure MySQL properly.
setting file my.ini :
innodb_flush_method=normal

Log sequence number in ibdata files does not match

Everytime when I start my Mysql database I see this in the error_log:
131015 12:07:06 [Note] Plugin 'FEDERATED' is disabled. 131015 12:07:06
InnoDB: The InnoDB memory heap is disabled 131015 12:07:06 InnoDB:
Mutexes and rw_locks use Windows interlocked functions 131015 12:07:06
InnoDB: Compressed tables use zlib 1.2.3 131015 12:07:06 InnoDB:
Initializing buffer pool, size = 16.0M 131015 12:07:06 InnoDB:
Completed initialization of buffer pool 131015 12:07:06 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! 131015 12:07:06 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... 131015 12:07:07 InnoDB: Waiting for the background threads
to start 131015 12:07:08 InnoDB: 5.5.32 started; log sequence number
1595695 131015 12:07:08 [Note] Server hostname (bind-address):
'0.0.0.0'; port: 3306 131015 12:07:08 [Note] - '0.0.0.0' resolves to
'0.0.0.0'; 131015 12:07:08 [Note] Server socket created on IP:
'0.0.0.0'.
I've tried mysqlcheck -u root -p --repair -A in order to repair the database. This reports that all tables are a-ok.
I've also tried setting innodb_force_recovery to 4
I've tried SET GLOBAL innodb_fast_shutdown = 1; and shutdown the DB.
None of these make the errors go away.
How do I repair the InnoDB tables in my database?
I resolve my problem by removing some files in "Xampp\mysql\data":
ib_logfile0
ib_logfile1
ibdata1
** Be Sure to Backup your DBs by :
[mysqld]
innodb_force_recovery = 2
(This command will help you to start Mysql in Read-only mode.)
LSN (log sequence number) may not match if MySQL crashed.
But if the crash recovery process finished you should be fine. If any transaction modifies data in a page, new LSN will be written to the page header.
I would investigate why MySQL crashes every time you restart it. To my knowledge /etc/init.d/mysql stop may take long time, so if you restart the server OS may just kill mysqld. In that case you should manually stop MySQL before reboot the whole server.
I had the same issue.
In my case, I was running MySQL on windows via XAMPP and using the XAMPP controls to start/stop the server.
It appears the XAMPP shutdown control was killing the MySQL server, rather than requesting a shutdown.
Solution
(optional) In my.ini set innodb_fast_shutdown=0 to configure mysqld to perform a full showdown
Create a .bat file, with contents mysqladmin --user=[user] --password=[password] shutdown replacing [user] and [password] with your root user details
When you wish to shutdown the MySQL server, just run the .bat file. The shutdown is detected by XAMPP control panel so you can restart using the XAMPP control.
If you now take a look at your logs, you'll see the errors have gone away
Or better yet, just install mysql as a windows service.
References:
innodb_fast_shutdown http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_fast_shutdown
mysqladmin shutdown - http://dev.mysql.com/doc/refman/5.7/en/server-shutdown.html

No connection could be made because the target machine actively refused it (PHP / WAMP)

Note: I realise this could be seen as a duplicate but i have looked at the other responses and they didn't fix the problem for me.
I have recently installed Zend Studio and Zend Server with the mysql plugin on Windows 7.
I am not a qualified server administrator but neither am i completely incompetent; i have dedicated my day trying to get a local development 'server' up to cut down on upload/download times.
When I say server/machine i mean my home computer
I have come to a grinding halt trying to get mysql to work with Zend Server.
The error I keep receiving is (or verbose):
#2002 Cannot log in to the MySQL server
or (if i change to 'config' authentication type)
#2002 - No connection could be made because the target machine actively refused it.
The server is not responding (or the local server's socket is not correctly configured).
I have tried:
Change $cfg['Servers'][$i]['host'] from 'localhost' to '127.0.0.1'
Add/Remove $cfg['Servers'][$i]['socket'] = '';
Change from cookie to config auth type
reinstall server and mysql
Disable firewalls
Restarting machine
Zend's approach was to 'configure the phpmyadmin setup screen'... done that i don't know how many times.
Can anyone on here lend a hand, or point me in a direction that I haven't tried yet?
Go to C:\wamp\bin\mysql\mysql[your-version]\data
Copy and save "ib_logfile0" and "ib_logfile1" anywhere else.
delete "ib_logfile0" and ib_logfile1
Did the trick for me. hope it works for you too.
Its working fine.
But we will have to stop apache and mysql, We need to quit xampp and then delete file. when deleted successfully. now start xampp it will work properly..
Just Go to your Control-panel and start Apache & MySQL Services.
You might need:
In wamp\bin\mysql\mysqlX.X.XX\my.ini find these lines:
[client]
...
port = 3308
...
[wampmysqld64]
...
port = 3308
As you see, the port number is 3308 (or maybe 3306). You should :
use that port in applications, like WordPress: define('DB_HOST', 'localhost:3308')
or
change it globally in wamp\bin\apache\apache2.X.XXX\bin\php.ini change
mysqli.default_port = ... to 3308
Till yesterday I was able to connect to phpMyAdmin, but today I started getting this error:
2002-no-connection-could-be-made-because-the-target-machine-actively-refused
None of the answers here really helped me fix the problem, what helped me is shared below:
I looked at the mysql logs.[C:\wamp\logs\mysql.log]
It said
2015-09-18 01:16:30 5920 [Note] Plugin 'FEDERATED' is disabled.
2015-09-18 01:16:30 5920 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-09-18 01:16:30 5920 [Note] InnoDB: The InnoDB memory heap is disabled
2015-09-18 01:16:30 5920 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-09-18 01:16:30 5920 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-09-18 01:16:30 5920 [Note] InnoDB: Not using CPU crc32 instructions
2015-09-18 01:16:30 5920 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-09-18 01:16:30 5920 [Note] InnoDB: Completed initialization of buffer pool
2015-09-18 01:16:30 5920 [Note] InnoDB: Highest supported file format is Barracuda.
2015-09-18 01:16:30 5920 [Note] InnoDB: The log sequence numbers 1765410 and 1765410 in ibdata files do not match the log sequence number 2058233 in the ib_logfiles!
2015-09-18 01:16:30 5920 [Note] InnoDB: Database was not shutdown normally!
2015-09-18 01:16:30 5920 [Note] InnoDB: Starting crash recovery.
2015-09-18 01:16:30 5920 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-09-18 01:16:30 5920 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace harley/login_confirm uses space ID: 6 at filepath: .\harley\login_confirm.ibd. Cannot open tablespace testdb/testtable which uses space ID: 6 at filepath: .\testdb\testtable.ibd
InnoDB: Error: could not open single-table tablespace file .\testdb\testtable.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
I got the clue that this guy is creating a problem - InnoDB: Error: could not open single-table tablespace file .\testdb\testtable.ibd
and this line 2015-09-18 01:16:30 5920 [Note] InnoDB: Database was not shutdown normally!
hmmm, For me the testdb was just a test-db! hence I decided to delete this file inside C:\wamp\bin\mysql\mysql5.6.17\data\testdb
and restarted all services, and went to phpMyAdmin, and this time no issues, phpMyAdmin opened :)
I'm having the same problem with Wampserver. It’s worked for me:
You must change this file: "C:\wamp\bin\mysql[mysql_version]\my.ini"
For example: "C:\wamp\bin\mysql[mysql5.6.12]\my.ini"
And change default port 3306 to 80. (Lines 20 & 27, in both)
port = 3306
To
port = 80
I hope this is helpful.
All I have to do in order to get rid of that error was to restart my wamp server.
In my case i did the following and worked for me
I clicked on the wamp icon.
i went to MySQL > Service administration 'wampmysqld64' > install service
Then click on wamp icon > Restart all service.
Please check your hosts file in etc folder and add below comments then run wamp server.
127.0.0.1 localhost
Path : C:\Windows\System32\drivers\etc
I have just removed the mysql service and installed it again. It works for me
Kindly check is your mysql-service is running.
for windows user: check the services - mysql service
for Linux user: Check the mysql service/demon is running (services mysql status)
Thanks & Regards
Jaiswar Vipin Kumar R
following steps worked for me.
Go to wamp\apps\phpmyadmin
search config.inc.php
search 127.0.0.1 and replace with "localhost".