启动mysql报错The server quit without updating PID file

启动MYSQL数据库时,报 ERROR! The server quit without updating PID file

root@localhost bin# ps -ef |grep mysql

root 155995 110447 0 03:24 pts/0 00:00:00 grep --color=auto mysql

root@localhost bin# service mysqld start

Starting MySQL.Logging to '/data/mysql/data/localhost.localdomain.err'.

2023-11-06T08:24:13.596845Z mysqld_safe The file /usr/local/mysql/bin/mysqld

does not exist or is not executable. Please cd to the mysql installation

directory and restart this script from there as follows:

./bin/mysqld_safe&

See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information

ERROR! The server quit without updating PID file (/data/mysql/data/localhost.localdomain.pid).

主要原因是我没有修改mysqld_safe文件中的安装目录和数据目录。

root@localhost bin# ./mysql

mysql mysql_config_editor mysqldumpslow mysql_secure_installation mysql_upgrade

mysqladmin mysqld mysql_embedded mysqlshow mysqlxtest

mysqlbinlog mysqld-debug mysqlimport mysqlslap

mysqlcheck mysqld_multi mysql_install_db mysql_ssl_rsa_setup

mysql_client_test_embedded mysqld_safe mysql_plugin mysqltest_embedded

mysql_config mysqldump mysqlpump mysql_tzinfo_to_sql

root@localhost bin# ./mysqld_safe --datadir=/data/mysql/data/

2023-11-06T08:32:36.755407Z mysqld_safe Logging to '/data/mysql/data//localhost.localdomain.err'.

2023-11-06T08:32:36.758791Z mysqld_safe error: log-error set to '/data/mysql/data//localhost.localdomain.err', however file don't exists. Create writable for user 'mysql'.

root@localhost bin# chown -R mysql:mysql /data/mysql/

root@localhost bin# chmod -R 777 /data/mysql/

root@localhost bin# ./mysqld_safe --datadir=/data/mysql/data/

2023-11-06T08:33:47.980123Z mysqld_safe Logging to '/data/mysql/data//localhost.localdomain.err'.

2023-11-06T08:33:47.983541Z mysqld_safe error: log-error set to '/data/mysql/data//localhost.localdomain.err', however file don't exists. Create writable for user 'mysql'.

修改完数据库可以启动了,开始修改数据库密码,又以下错误,原来是没有权限创建sock文件,做了软链接

mysql@localhost bin$ ./mysql -u root -p'S>Vqjfffwl2344444444455e2vJ'

mysql: Warning Using a password on the command line interface can be insecure.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

mysql@localhost bin$ ln -s /var/lib/mysql/mysql.sock /tmp

mysql@localhost bin$ ./mysql -u root -p'S>qVwjffwle2evJ'

mysql: Warning Using a password on the command line interface can be insecure.

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

Your MySQL connection id is 3

Server version: 5.7.17

Copyright © 2000, 2016, 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> alter user 'root'@'localhost' identified by 'password';

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

mysql>

搞定。

相关推荐
摇滚侠11 分钟前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
ApacheSeaTunnel2 小时前
实战演示 | 基于 Apache SeaTunnel 与 Apache DolphinScheduler 实现 MySQL 到 Doris 离线定时增量同步
大数据·mysql·开源·doris·数据集成·seatunnel·数据同步
weiggle2 小时前
第七篇:状态提升与单向数据流——架构设计的核心
android
xingpanvip2 小时前
星盘接口开发文档:本命盘接口指南
android·开发语言·css·php·lua
DARLING Zero two♡2 小时前
【MySQL数据库】数据类型与表约束
数据库·mysql
goldenrolan2 小时前
A公司物料替代测试系统 v1.7:从需求到 exe/apk 的 AI 辅助全链路实践
android·自动化测试·软件测试·python·ai
活宝小娜3 小时前
mysql详细安装教程
数据库·mysql·adb
AC赳赳老秦4 小时前
用 OpenClaw 搭建服务器故障应急响应系统,自动处理 80% 常见运维故障
android·运维·服务器·python·rxjava·deepseek·openclaw
Database_Cool_4 小时前
什么是数据仓库物化视图?AnalyticDB MySQL 实时物化视图能力解析
人工智能·mysql·阿里云
Database_Cool_4 小时前
即席查询(Ad-Hoc)数据库选型:AnalyticDB MySQL 秒级 Ad-Hoc 分析方案
数据库·mysql