首页 > 数据库 >ubuntu22.04安装mysql

ubuntu22.04安装mysql

时间:2023-03-07 20:58:59浏览次数:43  
标签:新密码 set ubuntu22.04 vim mysqld user mysql 安装

1.安装

sudo apt install mysql-server

2.设置

vim  /etc/mysql/mysql.conf.d/mysqld.cnf

[mysqld]后加入skip-grant-tables

3.重启服务

service mysql restart

4.免密码进入mysql

mysql -uroot -p

use mysql;
update mysql.user set authentication_string=password('新密码') where user='root'and Host ='localhost';
update user set plugin="mysql_native_password"; 
flush privileges;
quit;

5.清除设置

vim /etc/mysql/mysql.conf.d/mysqld.cnf

去掉刚才的配置

6.重启服务,用新密码进入

 




标签:新密码,set,ubuntu22.04,vim,mysqld,user,mysql,安装
From: https://www.cnblogs.com/angbors/p/17189610.html

相关文章