安装Mysql ubuntu:V18 参考:https://www.jianshu.com/p/4583aebf247a sudo apt update sudo apt install mysql-server 忘记mysql ro
参考:https://www.jianshu.com/p/4583aebf247a
sudo apt update
sudo apt install mysql-server
参考:Https://blog.csdn.net/luckytanggu/article/details/80251833
$ service mysql stop
# 查找my.cnf文件在哪里
$ find / -name my.cnf
/var/lib/dpkg/alternatives/my.cnf
/etc/alternatives/my.cnf
/etc/mysql/my.cnf
# 修改my.cnf文件,在文件新增 skip-grant-tables,在启动mysql时不启动grant-tables,授权表
$ vim /etc/mysql/my.cnf
[mysqld]
skip-grant-tables
$ service mysql restart
$ mysql
# 选择mysql数据库
mysql> use mysql;
# 更改user表中root用户密码
mysql> update user set authentication_string=PASSWORD("new_pass") where user=‘root‘;
# 注意:可能不同的数据库版本密码的字段名称不一样
# 我的数据库版本是5.7.21,user表中的密码字段是:authentication_string
mysql> select version();
+-------------------------+
| version() |
+-------------------------+
| 5.7.21-0ubuntu0.16.04.1 |
+-------------------------+
1 row in set (0.00 sec)
# 可以通过以下命令查看user表的密码字段名称
mysql> show create table userG;
$ vim /etc/mysql/my.cnf
[mysqld]
# skip-grant-tables
$ vim /etc/mysql/my.cnf
[mysqld]
# skip-grant-tables
Ubuntu安装MySQL
--结束END--
本文标题: Ubuntu安装MySQL
本文链接: https://www.lsjlt.com/news/7991.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-04-26
2024-04-26
2024-04-26
2024-04-26
2024-04-26
2024-04-26
2024-04-24
2024-04-24
2024-04-24
2024-04-24
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0