微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

mysql操作

1.查看MysqL的运行状态

systemctl status MysqL.service

 

 2.安装与初始化

https://t.codebug.vip/questions-691282.htm

sudo apt install MysqL-server MysqL-client #同时安装服务器和客户端
sudo MysqL_secure_installation

3.Error: Access denied for user 'root'@'localhost' (using password: YES)

https://blog.csdn.net/wangliyao518/article/details/83011522,根据这个来解决

vim修改只读文件

按‘a’表示进入插入模式,修改后执行

:w !sudo tee %

修改只读文件

按照如下命令解决了本问题:

vim /etc/MysqL/MysqL.conf.d/MysqLd.cnf
//修改只读文件在最后一行添加 skip-grant-tables,并保存

 service MysqL restart//重启服务

MysqL -uroot -p//回车可进入MysqL

use MysqL;
update user set authentication_string=PASSWORD("rootadmin") where user='root';

vim /etc/MysqL/MysqL.conf.d/MysqLd.cnf
//删除添加的最后一行 skip-grant-tables,并保存

service MysqL restart
MysqL -uroot -prootadmin

退出MysqL使用 quit; 命令

4.尝试创建表

create database yourdb;

报错:

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

根据https://blog.csdn.net/memory6364/article/details/82426052解决了:

alter user 'root'@'localhost' identified by '123456';

但要设置一个比较复杂的密码

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐