mysql显示错误error: ‘Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘

  1. Switch to the MySQL installation directory:

    cd mysql/
    
  2. Execute bin/mysqladminthe command to shut down the MySQL server:

    ./bin/mysqladmin -u root -p shutdown
    

    This will ask you to enter the password for the MySQL root user. After entering the password, the MySQL server will be shut down normally.

  3. Wait for a while to make sure the MySQL server is completely shut down.

  4. Start the MySQL server:

    ./bin/mysqld_safe &
    

    This will start the MySQL server. Please note that mysqld_safeis a script used to start and manage the MySQL server. Use &symbols to put it into the background.

  5. Wait for some time for the MySQL server to complete the startup process.

Guess you like

Origin blog.csdn.net/qq_46110497/article/details/130723047