WSL2安装MySQL8.0和redis
...小于 1 分钟
WSL2安装MySQL8.0和redis
安装MySQL8.0
sudo apt-get install mysql-server mysql-client
默认的root密码是空
sudo mysql
修改MySQL密码
CREATE USER 'terwer'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'terwer'@'%' WITH GRANT OPTION;
flush privileges;
创建默认数据库
create database databasename default character set utf8mb4 collate utf8mb4_general_ci;
hibernate的MySQL8.0配置
hibernate.connection.driverClass=com.mysql.cj.jdbc.Driver
hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
hibernate.connection.url=jdbc:mysql://localhost:3306/test?userSSL=true&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT
hibernate.connection.userName=terwer
hibernate.connection.password=123456
hibernate.hbm2ddl.auto=none
重启MySQL
sudo service mysql restart
停止MySQL
sudo service mysql stop
安装redis
sudo apt install redis
sudo /etc/init.d/redis-server stop
sudo /etc/init.d/redis-server restart
Powered by Waline v2.14.9