今日长缨在手,何时缚住苍龙。这篇文章主要讲述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>
【mysql 初始化无法设置password】配置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: 4Changed: 4Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
推荐阅读
- 小型企业网项目建设实践(详细过程)
- Redis | 第5章 Redis 中的持久化技术《Redis设计与实现》
- 如何编辑WordPress Pablo Gaudi主题容器高度
- 如何编辑基于wordpress的网站的内容( [关闭])
- 如何在wordpress中编辑topbar HTML()
- 如何使用PHP注释记录WordPress主题/插件的过滤器/操作
- 如何使用插件在每个wordpress页面上显示相同的文本数据
- 如何在WordPress中禁用作者查询
- 如何使用Docker在WordPress中进行开发()