Solution to mysql server 5.5 connection failure

Solution to mysql server 5.5 connection failure

The solution to the problem that mysql cannot be connected is for your reference. The specific contents are as follows

It worked fine yesterday, but the next day it suddenly couldn't connect to the MySQL database and reported an error:

After careful consideration, it is very likely that the table was damaged because some data in the MySQL built-in table was accidentally deleted. Oracle was also damaged before.....

So don't delete the system table information casually

Enter the service, find mysql, and find that the service has stopped. Restart the service and find that it cannot be restarted, as follows

Unable to restart, report 1067

And it is not possible to enter msyql in the dos command

Then I checked the system log information in the transaction manager and found that mysql had an error, as follows

There are two error messages:

1. Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

2. Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

I found many solutions online but none of them worked. I was ready to reinstall MySQL, but I was thinking about what to do with the previous database. I also looked up how to import the previous database data, but it was not easy to do and I didn't find a way. However, when I was about to reinstall, I found a solution, as follows:

1. Find the original installation package, double-click it, select repair, and repair the service.

2. After the repair was completed, a miracle happened and the MySQL service was actually running

3. At this time, open navicat to connect and an error is displayed

Access denied for user 'root'@'localhost' (using password: YES)

The solution to this problem is everywhere on the Internet. I will provide you with a solution:

When developing a web project in MyEclipse these two days, a problem occurred when connecting to the MYSQL database: Access denied for user 'root'@'localhost'(using password:YES).

After searching for information, I found that the root account does not have remote access permissions by default, so the relevant permissions need to be modified.

Solution:

1. Open the my.ini file in the MySQL directory, add a line "skip-grant-tables" at the end of the file, save and close the file. (WIN7 default installation, my.ini is in C:\ProgramData\MySQL\MySQL Server 5.6)
2. Restart the MySQL service.
3. Enter the MySQL BIN directory through the command line, enter "mysql -u root -p" (without entering a password), and ignore the password prompt. Just press Enter to enter the database. (WIN7 default installation, BIN directory is: C:\Program Files\MySQL\MySQL Server 5.6\bin)
4. Execute "use mysql;" to use the MySQL database.
5. Execute "update user set password=PASSWORD("123456") where user='root';" (change the root password)
6. Open the my.ini file in the MySQL directory, delete the last line of "skip-grant-tables", save and close the file.
7. Restart the MySQL service.
8. Enter "mysql -u root -p 123456" in the command line to successfully connect to the database.

After completing the above steps, MyEclipse can successfully connect to MySQL.

Thank you for this netizen's solution.

At this point the problem has been solved and I feel much better.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to enable remote connection to MySQL database
  • Solution to MySQL remote connection loss problem (Lost connection to MySQL server)
  • How to configure mysql to allow remote connections
  • Solution to MySQL remote connection failure
  • Mac OS solves the problem of not being able to use localhost to connect to mysql
  • How to solve the problem of unsuccessful connection to Mysql using localhost in PHP
  • How to solve the problem that MySQL cannot be connected remotely
  • Solution to SQL Error (2013) connection error in MySQL
  • KB967723 causes MySQL to frequently fail to connect
  • Solution to the problem of mysql service starting but not connecting

<<:  Implementation of formatting partitions and mounting in Centos7

>>:  Introducing icons by implementing custom components based on Vue

Recommend

Linux /etc/network/interfaces configuration interface method

The /etc/network/interfaces file in Linux is used...

Binary Search Tree Algorithm Tutorial for JavaScript Beginners

Table of contents What is a Binary Search Tree (B...

Specific usage of fullpage.js full screen scrolling

1.fullpage.js Download address https://github.com...

How to use cursor triggers in MySQL

cursor The set of rows returned by the select que...

How to use MySQL common functions to process JSON

Official documentation: JSON Functions Name Descr...

How to migrate mysql storage location to a new disk

1. Prepare a new disk and format it with the same...

Detailed explanation of Linux file permissions and group modification commands

In Linux, everything is a file (directories are a...

Write your HTML like this to make your code more compatible

For example, users who need screen reading softwar...

Detailed explanation of docker visualization graphics tool portainer

Table of contents 1. Introduction to Portainer 2....

JavaScript to achieve custom scroll bar effect

In actual projects, the up and down scroll bars a...

CentOS 7 method to modify the gateway and configure the IP example

When installing the centos7 version, choose to co...

React internationalization react-intl usage

How to achieve internationalization in React? The...