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

MySQL 8.0 New Features: Hash Join

The MySQL development team officially released th...

How to install mysql via yum on centos7

1. Check whether MySQL is installed yum list inst...

MySQL export of entire or single table data

Export a single table mysqldump -u user -p dbname...

Share some key interview questions about MySQL index

Preface An index is a data structure that sorts o...

How to package the uniapp project as a desktop application

Installing Electron cnpm install electron -g Inst...

How to use node to implement static file caching

Table of contents cache Cache location classifica...

How to enable the root account in Ubuntu 20.04

After Ubuntu 20.04 is installed, there is no root...

Share 5 JS high-order functions

Table of contents 1. Introduction 2. Recursion 3....

Vue uses better-scroll to achieve horizontal scrolling method example

1. Implementation principle of scrolling The scro...

Docker image analysis tool dive principle analysis

Today I recommend such an open source tool for ex...

How to connect Navicat to the docker database on the server

Start the mysql container in docekr Use command: ...

CSS sets the box container (div) height to always be 100%

Preface Sometimes you need to keep the height of ...

Example code for evenly distributing elements using css3 flex layout

This article mainly introduces how to evenly dist...