Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mysql in WSL #71

Open
AllanChain opened this issue Feb 19, 2020 · 0 comments
Open

Mysql in WSL #71

AllanChain opened this issue Feb 19, 2020 · 0 comments
Labels
blog: programming @post This is a blog post tag: mysql |132950002-15455ec6-a178-4488-845b-94e97243f3e3.jpg

Comments

@AllanChain
Copy link
Owner

AllanChain commented Feb 19, 2020

View Post on Blog

This post was originally created at 2020-02-07T16:59:02+08:00

😜 TL;DR

查看日志/var/log/mysql/error.log,上互联网搜


在使用 Windows Subsystem for Linux 时,可能因为缺少对 MySQL 是预置安装,会遇到一些问题

如果说

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

可以试试建立 /var/run/mysqld 目录,并给 mysql 权限

如果说

No directory, logging in with HOME=/

可以试试 sudo usermod -d /var/lib/mysql/ mysql


更新了一次系统后,MySQL 又无法启动了。刚开始还以为是更新的时候之前的配置被抹掉了,可并不是。。

UPDATE: 不要听下面这个部分

根据microsoft/WSL#3631 (comment),是 MySQL 版本太高了。。自动升到了 8.x。还要按照步骤回退。。:rage:

但是但是,由于我作死升到了 eoan,那个仓库并不支持。所以去 https://dev.mysql.com/downloads/repo/apt/ 下载了最新的。然而,并没有 5.7 的选项:sob:

所以只能强行安装 Ubuntu 19.04 的包了,下载对应的 deb 文件:

wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb

或者。。直接装 Windows 上,说不定也可。


UPDATE: 事实证明,是 MySQL 未正确升级所致,只需要完全删除 MySQL,再重新安装,就可以了(只要备份了重要文件)

sudo apt remove --purge *mysql*
sudo apt remove --purge *mariadb*
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt autoremove
sudo apt autoclean
@AllanChain AllanChain changed the title Mysql in Wsl | AC's Blog Mysql in Wsl Jun 24, 2020
@AllanChain AllanChain added blog: programming tag: mysql |132950002-15455ec6-a178-4488-845b-94e97243f3e3.jpg labels Jun 24, 2020
@AllanChain AllanChain changed the title Mysql in Wsl Mysql in WSL Jun 24, 2020
@AllanChain AllanChain added the @post This is a blog post label Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blog: programming @post This is a blog post tag: mysql |132950002-15455ec6-a178-4488-845b-94e97243f3e3.jpg
Projects
None yet
Development

No branches or pull requests

1 participant