龙空技术网

宝塔中关于使用数据库问题

青城树叶 129

前言:

眼前大家对“mysql启动pid ended”大概比较注意,看官们都想要知道一些“mysql启动pid ended”的相关文章。那么小编在网上网罗了一些关于“mysql启动pid ended””的相关资讯,希望朋友们能喜欢,看官们快快来学习一下吧!

今天在使用宝塔时,遇到不能添加数据库,开始了折腾之旅。。。

各种删除数据库、卸载mysql、重新安装mysql,还是不能解决问题。

开始百度,谷歌查看资料,尝试过,还是没有解决。。。是不是宝塔bug了???结果去另一台服务器发现可以正常使用。。。继续找资料来解决。。。最后终于找到解决办法了。

可以通过一个mysql的参数 –skip-grant-tables & 轻松解决这个问题。其中 --skip-grant-tables 的意思是跳过授权表,通过此参数来跳过输入密码,后面跟得 & 符号是表示设置此进程为后台进程。

操作如下:

1.首先关闭掉MySQL系统服务:

[root@4bjk9r8aZ ~]# service mysqld stop

Shutting down MySQL.211110 15:54:37 mysqld_safe mysqld from pid file /www/server/data/4bjk9r8aZ.pid ended

2.使用命令跳过输入密码过程:

[root@4bjk9r8aZ ~]# mysqld_safe --skip-grant-tables &

[1] 14285

[root@4bjk9r8aZ ~]# 211110 15:55:57 mysqld_safe Logging to '/www/server/data/4bjk9r8aZ.err'.

211110 15:55:57 mysqld_safe Starting mysqld daemon with databases from /www/server/data

mysql(输入)

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.62-log Source distribution

Copyright (c) 2000, 2018, 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)

3.进入 mysql数据库,然后通过语句修改密码:

mysql> use mysql

Database changed

mysql> update user set password=password("123456") where user='root';

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

mysql> exit;

Bye

4.重启mysql服务

[root@4bjk9r8aZ ~]# service mysqld restart

Shutting down MySQL.211110 16:08:13 mysqld_safe mysqld from pid file /www/server/data/4bjk9r8aZ.pid ended

[ OK ]

Starting MySQL.. [ OK ]

[1]+ Done mysqld_safe --skip-grant-tables

标签: #mysql启动pid ended