mysql 初始化无法设置password
Posted X糊涂仙儿
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql 初始化无法设置password相关的知识,希望对你有一定的参考价值。
填加skip-grant-tables
vim /etc/my.cnf
skip-grant-tables
启动systemctl start mysqld,mysql -uroot -p提示:
[root@ops1 ~]# mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Cant connect to local MySQL server through socket /var/lib/mysql/mysql.sock (2)
建立软链接
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
或者
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
重启mysql并进入mysql
systemctl restart mysqld
[root@ops1 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 3
Server version: 5.6.51 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type help; or \\h for help. Type \\c to clear the current input statement.
mysql>
配置root的password
mysql> update user set password=password(123456) where user="root";
ERROR 1046 (3D000): No database selected
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password=password(123456) where user="root";
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
以上是关于mysql 初始化无法设置password的主要内容,如果未能解决你的问题,请参考以下文章
连接MySQL出现错误:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)(代码片段
MySQL服务无法启动 + MySQL 初始化没有反应 + must reset ur password
MySQL服务无法启动 + MySQL 初始化没有反应 + must reset ur password
mysql初始设置密码报错处理方法ERROR 1819 (HY000): Your password does not satisfy the current policy requirement