当前位置:网站首页>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
根据提示输入密码,即可成功进入:
边栏推荐
- Tips 𞓜 how to clean PCB boards 2021-10-22
- WinForm implementation window is always at the top level
- 基于RBAC 的SAAS系统权限设计
- Knowledge sharing 𞓜 conventional laminated structure of six layer PCB
- 【论文学习】《VQMIVC》
- Basic use of ActiveMQ in Message Oriented Middleware
- 饮食干预减轻癌症治疗相关症状和毒性
- C#获取exe的版本号-文件版本and程序集版本
- 用函数的递归来解决几道有趣的题
- 力扣76题,最小覆盖字串
猜你喜欢

【论文学习】《VQMIVC》

VOCALOID笔记

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

Six causes of PCB disconnection 2021-10-20

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

PCB board design - automatic layout 2021-10-15

Anaconda navigator启动慢的一个解决方法

"Spatial transformation" significantly improves the quality of ground point extraction of cliff point cloud

Take you through the normalization flow of GaN

C#中如何调整图像大小
随机推荐
1464. 数组中两元素的最大乘积
Invalid Navicat scheduled task
Linux上oracle和mysql的启动,关闭,重启
Pcb|about FPC reinforcement type
Force deduction 76 questions, minimum covering string
【Unexpected token o in JSON at position 1出错原因及解决方法】
2265. 统计值等于子树平均值的节点数
OAuth 2.0 one click login
Hisilicon 3559 sample parsing: Vio
VOCALOID笔记
PCB board design - automatic layout 2021-10-15
NPM install reports an error: gyp err! configure error
微信小程序开通客服消息功能开发
Audio (V) audio feature extraction
Analysis and utilization of Microsoft Office Word remote command execution vulnerability (cve-2022-30190)
1464. maximum product of two elements in an array
[distillation] pointdistiller: structured knowledge distillationwards efficient and compact 3D detection
“空间转换”显著提升陡崖点云的地面点提取质量
STL tutorial 4- input / output stream and object serialization
What are the problems with traditional IO? Why is zero copy introduced?