MySQL failed to start issue summary

Source: Internet
Author: User
Tags mysql manual socket


First, verify that MySQL is configured and correct

Re-configure

If you are reinstalling MySQL, please confirm that after the installation of MySQL after the first configuration, otherwise will be missing My.ini files, configuration method, can be installed to the last step of the selection, now start to configure MySQL, or in the program group run the MySQL Configuration Wizard. After the configuration is complete, make sure that there are at least Basedir installation directory paths and DataDir database paths under the [Mysqld] field in the My.ini file.

Prior to configuration, if you already have a MySQL configuration, you can perform a remove INSTANCE in the MySQL wizard before you reconfigure it.

Overwrite data table

The default MySQL database is installed under my document, so if your database directory is in other paths, you can stop MySQL first, then cut the database to another path, and then copy the relevant datasheet into the same directory.

If the MySQL datasheet uses a different account, you will also need to create an account in MySQL, or use the original MySQL datasheet to overwrite it (you need to confirm that the MSYQL datasheet was undamaged).

Resolve failed to start

Common workaround when you encounter a failure to start MySQL:

A, first use the command C:Program filesmysqlbinmysqladmin-u root-p shutdown to close MySQL

B, and then under the cmd command line, execute net start MySQL to start MySQL.

Two, 1067 error common solution

Failure phenomenon

If there is a 1067 error while stopping MySQL (net stop MySQL) or starting MySQL, the error message "MySQL service is stopping ... System error (A Systems error has occurred ...). System error 1067 has occurred., the process terminates unexpectedly (the processes terminated unexpectedly.).

Common Solutions

1. If you have previously run OK, please follow the above "Cannot start" solution to perform a look.
2. If the remove instance operation, after rebuilding again, be sure to check the My.ini file DataDir has been restored, if the database does not exist under the address, will also report 1067 errors, only need to modify into a real database directory address, and then manually start.
3. Check MySQL directory permissions
4. Check the [mysqld] field in the My.ini file for basedir installation directory path and DataDir database path, My.ini may need to appear in two places, MySQL installation directory and Windows directory (assuming Windows environment), Have to check.
5. Sometimes delete%windir%/my.ini files and then reconfigure can also be resolved, once again configured to check the windir directory whether there are my.ini files, and sometimes the installation directory under the latest My.ini copy of the past cover can also solve the problem.
6. If it is a Linux environment, try to copy the Mysql.server to/etc/rc.d/init.d/, then run Chkconfig mysql.server, then you can set path in the command line, use the command to perform MySQL boot.

Third, illegal shutdown caused by MySQL can not start the problem

If it is because of illegal shutdown and other reasons MySQL can not start or start a problem, it is best to use the reinstall or confirm that the MySQL data table is OK and ibdata1, Mysql.pid, IB_LOGFILE0, and other documents to cover, the days have encountered many times this situation, is the original MySQL table has a problem, always can not start, but the new table can be changed.

MySQL Unable to start problem due to full space on log

Tail/usr/local/mysql/var/slyar.err

Look at the error log MySQL, the unexpected situation appears ...

Disk is full writing './mysql-bin.~rec~ ' (errcode:28). Waiting for someone. (Expect up to secs delay for server to continue after freeing disk spaces)

Amazing situation, incredibly because the disk is full, unable to write to the log caused MySQL not to start

The code is as follows Copy Code

root@slyar# DF
FileSystem 1k-blocks Used Available use% mounted on
/DEV/SDA1 3016688 2877540 0 100%/

Sure enough, the/var catalog exploded.

  code is as follows copy code

root@slyar:/ usr/local/mysql/var# ll--BLOCK-SIZE=MB
Total 504MB
-rw-rw----1 mysql mysql 26MB June June mysql-bin.000011
-RW-RW----1 MySQL mysql 5MB June mysql-bin.000012
-RW-RW----1 mysql mysql 27MB Aug 8 mysql-bin.000013-rw-rw----1 mysql mysql 43MB Aug mysql-bin.000014
-rw-rw----1 mysql mysql 270MB Feb 9 17:05 mysql-bin.000 020
-rw-rw----1 mysql mysql 115MB Apr 12:27 mysql-bin.000021
-rw-rw----1 mysql mysql 1MB Feb ten 12:07 Mysql-b In.index
-RW-RW----1 mysql mysql 0MB Apr 12:34 mysql-bin.~rec~

Basically, it's all over the stuff. mysql manual found that these things are not useful, direct deletion (this operation is best done when the MySQL service is stopped, because the current log can not be used to delete, and may cause some other problems, but with Mysql>reset Master command to clear the log directly)

The code is as follows Copy Code

root@slyar:/usr/local/mysql/var# rm-f mysql-bin.*

To prevent such a situation from recurring, turn off MySQL's log-bin log function directly

Vim/etc/my.cnf

Found it:

The code is as follows Copy Code
Log-bin=mysql-bin
Binlog_format=mixed

In front Plus # comment out,: Wq Save exit

At last

The code is as follows Copy Code

/etc/init.d/mysql restart

Start the MySQL service, everything is OK.


ERROR 2002 (HY000):


Start MySQL Error:

ERROR 2002 (HY000): Can ' t connect to the local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2)

1, first view/etc/rc.d/init.d/mysqld status to see if the M y S Q has been started.
Also see if it's a permission issue.

2, to determine if your mysql.sock is in that position,
Mysql-u your MySQL username-p-s/var/lib/mysql/mysql.sock

3. Try: Service mysqld start

4, if it is a permission issue, change the permissions first #chown-R mysql:mysql/var/lib/mysql

[Root@localhost ~]#/etc/init.d/mysqld start
Start MySQL: [OK]
[Root@localhost ~]# Mysql-uroot-p

ERROR 2002 (HY000): Can ' t connect to the local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2)
The reason for this is that the/var/lib/mysql access rights issue.

The code is as follows Copy Code

Shell> Chown-r Mysql:mysql/var/lib/mysql

Then start the server

The code is as follows Copy Code

Shell>/etc/init.d/mysql Start

After the server is started, see/var/lib/mysql automatically generate Mysql.sock files.

But my problem is still unresolved.

The problem is finally resolved:
Methods: Modify/etc/my.conf:

The code is as follows Copy Code

[Mysqld]
Datadir=/usr/local/mysql/data
Socket=/var/lib/mysql/mysql.sock

[Mysql.server]
User=mysql
Basedir=/usr/local/mysql

If There is isn't currently a section called [Client], add one at the bottom of the "File and copy" socket= line under the [MYSQLD] section such as:


[Client]
Socket=/var/lib/mysql/mysql.sock

Found still, running/etc/init.d/mysql start error:    starting mysqlcouldn ' t find MySQL manager or server
MYSQLD Service is not open, run/usr/local/mysql/bin/mysqld_safe

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.