当前位置:网站首页>Ubuntu18下登录mysql 5.7设置root密码
Ubuntu18下登录mysql 5.7设置root密码
2022-06-25 06:42:00 【simple_whu】
使用命令行apt-get安装完mysql之后,虚拟机中/etc/mysql文件夹下大致如图所示:
1. 修改/etc/mysql/my.cnf文件
sudo vim /etc/mysql/my.cnf
在文件最后添加如下两行内容
[mysqld]
skip-grant-tables
2.重新启动mysql服务
systemctl restart mysql
3.进入mysql,设置root用户密码
这次直接输入mysql即可无密码登录,运行下面的命令设置root用户密码:
update mysql.user set authentication_string=PASSWORD('new_password') where user='root';
flush privileges;
4. 再次修改/etc/mysql/my.cnf文件
去掉第一步中添加的两行内容:
sudo vim /etc/mysql/my.cnf
删除文件最后的如下两行内容
[mysqld]
skip-grant-tables
5.重新启动mysql服务
systemctl restart mysql
6.使用密码登录mysql
mysql -u root -p
根据提示输入密码,即可成功进入:
边栏推荐
- How to select lead-free and lead-free tin spraying for PCB? 2021-11-16
- Accès à la boîte aux lettres du nom de domaine Lead à l'étranger
- Pit encountered by pytorch: why can't l1loss decrease during model training?
- WinForm implementation window is always at the top level
- SSL证书免费获取教程
- 【Unexpected token o in JSON at position 1出错原因及解决方法】
- 力扣76题,最小覆盖字串
- 力扣76题,最小覆盖字串
- Keil and Proteus joint commissioning
- C reads XML on the web
猜你喜欢

The method of judging whether triode can amplify AC signal

Cifar-10 dataset application: quick start data enhancement method mixup significantly improves image recognition accuracy

Misunderstanding of switching triode

用函数的递归来解决几道有趣的题

npm install 报错 : gyp ERR! configure error

opencv最小值滤波(不局限于图像)

微信小程序开通客服消息功能开发
![[little knowledge] PCB proofing process](/img/bf/f66677294a14baf08cc35d1e8c1e31.jpg)
[little knowledge] PCB proofing process

Five causes of PCB board deformation and six solutions 2021-10-08

Fairmot yolov5s to onnx
随机推荐
力扣76题,最小覆盖字串
基于激光雷达的林业调查常用术语及含义锦集
c# winform panel自定义图片和文字
Bicubic difference
How to select lead-free and lead-free tin spraying for PCB? 2021-11-16
The fourth floor is originally the fourth floor. Let's have a look
LeetCode_哈希表_中等_454.四数相加 II
Lebel only wants an asterisk in front of it, but doesn't want to verify it
[little knowledge] PCB proofing process
Usememo simulation usecallback
Vscode is good, but I won't use it again
Five causes of PCB board deformation and six solutions 2021-10-08
Fairmot yolov5s to onnx
双三次差值bicubic
个人域名和企业域名的区别
Atlassian confluence漏洞分析合集
力扣78:子集
Force deduction 76 questions, minimum covering string
(tool class) use SecureCRT as the communication medium
One "stone" and two "birds", PCA can effectively improve the dilemma of missing some ground points under the airborne lidar forest