当前位置:网站首页>#yyds干货盘点#ubuntu18.0.4安装mysql并解决ERROR 1698: Access denied for user ''root''@''localhost''
#yyds干货盘点#ubuntu18.0.4安装mysql并解决ERROR 1698: Access denied for user ''root''@''localhost''
2022-04-23 09:18:00 【瑞士卷心菜】
最近学习linux,然后将win换成了ubuntu。之前安装的mysql也不能用了,现在将在ubuntu18.0.4上安装mysql并将碰到的问题记录如下:
下载并安装mysql
执行语句sudo apt-get install mysql-server
因为我这里已经安装好了的,所以会出现这样的。可以通过mysql –version查看安装版本。
登录mysql
执行语句 mysql -u root -p
其-u是user -p是端口。登录时出现ERROR 1698 (28000): Access denied for user ‘root’@‘localhost’。这应该时我们之前安装时候,pass忘记了或者不记得初始化pass造成的:
下面我们讲讲如何解决这个问题:
1.输入指令sudo vim /etc/mysql/debian.cnf
我们会看到如下信息:
其中debian-sys-maint账户是安装mysql时系统自动生成的mysql用户,对应的pass就是该用户的pass。
2.登录账户debian-sys-maint:
mysql -u debian-sys-maint -p
可以登录mysql:
3.修改root帐号pass:
输入指令 use mysql;
然后输入指令:
UPDATE user SET authentication_string = PASSWORD( ‘你要设置的pass ') where USER=‘root'; 这就是设置root账户的pass。
- 1.
然后输入指令quit,退出mysql,执行重启mysql指令sudo service mysql restart;
然后登录mysql,当执行 mysql -u root -p,发现还是报错了:ERROR 1524 (HY000): Plugin ‘msyql_native_password’ is not loaded
这时候pass其实已经修改成功了的,是plugin root 的字段是auth_socket,需要修改过来。
4.修改plugin:
继续使用debian-sys-maint
帐号登录;
执行指令:
use mysql
执行指令:
select user,plugin from user;
接着执行指令:
update user set authentication_string = password( ‘你要设置的 '),plugin=‘mysql_native_password' where user = ‘root ';
- 1.
最后退出并重启mysql即可:
版权声明
本文为[瑞士卷心菜]所创,转载请带上原文链接,感谢
https://blog.51cto.com/u_15452495/5247741
边栏推荐
- npm报错 :operation not permitted, mkdir ‘C: \Program Files \node js \node_ cache _ cacache’
- ALV tree (ll LR RL RR) insert delete
- 机器学习(六)——贝叶斯分类器
- 小程序报错 :should have url attribute when using navigateTo, redirectTo or switchTab
- Failed to prepare device for development
- The most concerned occupations after 00: civil servants ranked second. What was the first?
- 653. Sum of two IV - input BST
- [indexof] [lastIndexOf] [split] [substring] usage details
- MySQL小練習(僅適合初學者,非初學者勿進)
- 小程序报错:Cannot read property 'currentTarget' of undefined
猜你喜欢
Installation of data cleaning ETL tool kettle
valgrind和kcachegrind使用运行分析
Introduction to matlab
LeetCode_ DFS_ Medium_ 1254. Count the number of closed islands
112. 路径总和
爬虫使用xpath解析时返回为空,获取不到相应的元素的原因和解决办法
[reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)
valgrind和kcachegrind使用運行分析
小程序报错:Cannot read property 'currentTarget' of undefined
Pctp test experience sharing
随机推荐
Harbor enterprise image management system
Common errors of VMware building es8
Technological innovation in government affairs in the construction of Digital Government
政务中台研究目的建设目标,建设意义,技术创新点,技术效果
The crawler returns null when parsing with XPath. The reason why the crawler cannot get the corresponding element and the solution
653. Sum of two IV - input BST
PLC point table (register address and point table definition) cracking detection scheme -- convenient for industrial Internet data acquisition
kettle实验
【SQL server速成之路】数据库的视图和游标
调包求得每个样本的k个邻居
Concave hull acquisition method based on convex hull of point cloud
Talent Plan 学习营初体验:交流+坚持 开源协作课程学习的不二路径
数字政府建设中政务中台中的技术创新点
I don't understand time, timestamp and time zone. Look at this article
资源打包关系依赖树
Get trustedinstaller permission
Give the method of instantiating the object to the new object
MYCAT configuration
[boutique] using dynamic agent to realize unified transaction management II
Is Zhongyan futures safe and reliable?