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

Some questions about hyperlinks

<br />I am very happy to participate in this...

Example tutorial on using the sum function in MySQL

Introduction Today I will share the use of the su...

Tomcat parses XML and creates objects through reflection

The following example code introduces the princip...

MySQL 5.7.25 installation and configuration method graphic tutorial

There are two types of MySQL installation files, ...

Better-scroll realizes the effect of linking menu and content

1. Basic use <!DOCTYPE html> <html lang=...

Usage and best practice guide for watch in Vue3

Table of contents Preface🌟 1. API Introduction 2....

10 Tips for Mobile App User Interface Design

Tip 1: Stay focused The best mobile apps focus on...

Using HTML web page examples to explain the meaning of the head area code

Use examples to familiarize yourself with the mean...

How to deploy gitlab using Docker-compose

Docker-compose deploys gitlab 1. Install Docker I...

Graphical explanation of the underlying principle of JavaScript scope chain

Table of contents Preface Scope 1. What is scope?...

Implementation of vscode custom vue template

Use the vscode editor to create a vue template, s...

How to use CSS to achieve two columns fixed in the middle and adaptive

1. Use absolute positioning and margin The princi...