2024-10-27 11:27PM
我在命令行里面运行 sudo mysql -u root 报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
解决方法:
sudo /etc/init.d/mysql start
然后再重新运行 sudo mysql -u root
root@DESKTOP-8TI8PSU:/mnt/c/Ubuntu# sudo /etc/init.d/mysql start
* Starting MySQL database server mysqld
su: warning: cannot change directory to /nonexistent: No such file or directory [ OK ]
root@DESKTOP-8TI8PSU:/mnt/c/Ubuntu# sudo mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.39-0ubuntu0.22.04.1 (Ubuntu)
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
然后就可以了。
登录
请登录后再发表评论。
评论列表:
目前还没有人发表评论