环境说明
wsl1,lnmp套件(来自vpser,源码编译安装)
不能登录wsl 1045错误
首先确定一下,你没有忘记密码。如果你忘记了密码,请照着找回密码的步骤进行。
root@Origami:/home/bennyli/test_db-master# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
这个问题好象是wsl的连接方式默认是socket,但是windows下模拟的socket不兼容导致的(胡说八道中)(不要理会)
总之加上--protocol=TCP
就好了。
配置文件位置在哪里?没有找到。
update:这样也可以解决:
root@Origami:/home/bennyli/test_db-master# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 155
Server version: 5.7.30-log Source distribution
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
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>
参考
I run mysqld on Windows 10, how do I connect to its port from WSL
wsl安装mysql记录01:安装登陆
导入示例数据库
下载
https://github.com/datacharmer/test_db
然后
mysql -u root -p < employees.sql
或者
mysql --protocol=TCP -p < employees.sql
即可。
检验
mysql -t < test_employees_md5.sql