MySQL failed to start

Source: Internet
Author: User
Tags file permissions

MySQL Restart error

Error:

There are several possible reasons for this:

1.mysql没有正常关闭2.第二次在机器上安装mysql,有残余数据影响服务启动3.权限问题,可能是/opt/mysql/data/数据目录没有权限

Solution:

1.没有正常关闭的话,日志里会有写         [Note]?InnoDB: Database was not shutdown normally!          [Note] InnoDB: Starting crash recovery.         [Note] InnoDB:?Reading tablespace information from the .ibd files...     ?[ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace raildb/base_company_fullname uses space ID: 4 at filepath: ./raildb/base_company_fullname.ibd. Cannot open tablespace mysql/slave_master_info which uses space ID: 4 at filepath: ./mysql/slave_master_info.ibd    第一行:提示数据库没有正常关闭,第三行,提示正在从.ibd files读取tablespace information   error的地方,大概意思就是读取不到raildb这个库的tablespace 解决:vi /etc/my.cof  增加一行      innodb_force_recovery = 1         然后删除log里边的mysql-bin.index 这个文件         重启mysql2.解决:去mysql的数据目录/data看看,如果存在mysql-bin.index,删除掉3.权限问题不说

Perhaps my problem is more complicated, first of all, the machine two times to install MySQL, resulting in a restart error, abnormal stop MySQL, failed to start.

Solution: Delete the/tmp/mysql.sock file and restart MySQL

Here's an introduction to Mysql,sock

Mysql有两种连接方式: (1)TCP/IP  (2)socket    对mysql.sock来说,其作用是程序与mysqlserver处于同一台机器,发起本地连接时可用。    例如你无须定义连接host的具体IP得,只要为空或localhost就可以。    在此种情况下,即使你改变mysql的外部port也是一样可能正常连接。    因为你在my.ini中或my.cnf中改变端口后,mysql.sock是随每一次 mysql server启动生成的。已经根    据你在更改完my.cnf后重启mysql时重新生成了一次,信息已跟着变更。

If you delete the Mysql.sock file, you may report

  ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)   mysql.sock不存在

Mysql.sock is a temporary file that is automatically generated when MySQL is started and my server is not started, and naturally there is no Mysql.sock file.

In the error log, the reason for startup failure is very obvious, file './mysql-bin. 000004 ' not found,failed to open! MySQL turns on the bin log feature,

To the root of the database to view the file is present, possibly a problem with file permissions, because/tmp/mysql.sock does not exist, in such a way:

      >ln -s /var/lib/mysql/mysql .sock   /tmp/mysql .sock

MySQL failed to start

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.