记WSL下MySQL安装和使用BUG

本文档记录了在WSL环境下安装MySQL过程中遇到的两个问题:一是安装时权限不足导致的目录创建错误,二是设置密码时不符合策略要求。针对这些问题,提供了详细的操作步骤和解决方案,包括修改wsl-integration.sh文件、调整权限和更新密码策略。
摘要由CSDN通过智能技术生成

这里完全按照WSL官网安装MySQL


To install MySQL on WSL (Ubuntu 18.04):

  1. Open your WSL terminal (ie. Ubuntu 18.04).
  2. Update your Ubuntu packages: sudo apt update
  3. Once the packages have updated, install MySQL with: sudo apt install mysql-server
  4. Confirm installation and get the version number: mysql --version

You may also want to run the included security script. This changes some of the less secure default options for things like remote root logins and sample users. To run the security script:

  1. Start a MySQL server: sudo /etc/init.d/mysql start
  2. Start the security script prompts: sudo mysql_secure_installation
  3. The first prompt will ask whether you’d like to set up the Validate Password Plugin, which can be used to test the strength of your MySQL password. You will then set a password for the MySQL root user, decide whether or not to remove anonymous users, decide whether to allow the root user to login both locally and remotely, decide whether to remove the test database, and, lastly, decide whether to reload the privilege tables immediately.

To open the MySQL prompt, enter: sudo mysql

To see what databases you have available, in the MySQL prompt, enter: SHOW DATABASES;

To create a new database, enter: CREATE DATABASE database_name;

To delete a database, enter: DROP DATABASE database_name;

For more about working with MySQL databases, see the MySQL docs.

To work with with MySQL databases in VS Code, try the MySQL extension.


安装Bug: cannot create directory ‘//.cache’: Permission denied

然而,在执行sudo mysql这一步时,出现下面错误:

 * Starting MySQL database server mysqld                                                                                No directory, logging in with HOME=/
-su
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值