欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 游戏 > ubuntu安装mysql 8,mysql密码的修改

ubuntu安装mysql 8,mysql密码的修改

2024/10/24 21:23:08 来源:https://blog.csdn.net/m0_74312445/article/details/142557742  浏览:    关键词:ubuntu安装mysql 8,mysql密码的修改

目录

  • 1.安装mysql 8
  • 2.查看当前状态
  • 3.手动给数据库设置密码
    • mysql5
    • mysql8
  • 4.直接把数据库验证密码的功能关闭掉

1.安装mysql 8

apt install mysql-server-8.0

在这里插入图片描述
敲 Y 按回车
在这里插入图片描述
table 选ok

2.查看当前状态

service mysql status

在这里插入图片描述
显示active(running)证明安装成功!

3.手动给数据库设置密码

mysql5

alter user 'root'@'localhost' identified by 'newpassword''

mysql8

1.如果代码不为空:
use mysql
update user set authentication_string=' ' where user = 'root'; (将字段置为空)
alter user ‘root’@‘localhost’ identified by ‘newpassword’;(修改密码为newpassword) 
2.如果为空,直接修改
alter user ‘root’@‘localhost’ identified by ‘newpassword’;(修改密码为newpassword) 

在这里插入图片描述

4.直接把数据库验证密码的功能关闭掉

 cd /etc/mysql/

mysql默认在这个目录下
在这里插入图片描述
进入这个配置文件中

 cd mysql.conf.d

在这里插入图片描述

进入mysqld.cnf

vim mysqld.cnf

在这里插入图片描述

在这里按 “i” 输入

skip-grant-tables

这个配置会影响部署!(但是在mysql 5 可以)
在这里插入图片描述
保持退出即可

在这里插入图片描述
保存退出后,程序启动

mysql restart

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com