【解决】MySQL提示启动成功,实际进程并没有起来
一、概括:
1、查看运行日志 vim /var/log/mariadb/mariadb.log
2、修改配置文件 vim /etc/my.cnf
3、修改文件权限 chown mysql.mysql -R /var/lib/mysql/
二、详情:
首先我们尝试启动MySQL,发现没有MySQL进程
root@centos74-tmp sbin]# pwd
/usr/local/mysql/bin
[root@centos74-tmp bin]# service mysqld start
Starting MySQL SUCCESS!
[root@centos74-tmp bin]# pgrep -af mysql
我们查看日志 mariadb.log,发现缺少数据文件
[root@centos74-tmp bin]# vim /var/log/mariadb/mariadb.log
--15T01::.969191Z [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
--15T01::.969334Z [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
--15T01::.969372Z [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.) starting as process ...
--15T01::.976201Z [Note] InnoDB: PUNCH HOLE support available
--15T01::.976243Z [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
--15T01::.976249Z [Note] InnoDB: Uses event mutexes
--15T01::.976267Z [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
--15T01::.976272Z [Note] InnoDB: Compressed tables use zlib 1.2.
--15T01::.976277Z [Note] InnoDB: Using Linux native AIO
--15T01::.976564Z [Note] InnoDB: Number of pools:
--15T01::.976689Z [Note] InnoDB: Using CPU crc32 instructions
--15T01::.978521Z [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = , chunk size = 128M
--15T01::.988017Z [Note] InnoDB: Completed initialization of buffer pool
--15T01::.991091Z [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
--15T01::.001066Z [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!
--15T01::.001400Z [ERROR] InnoDB: Operating system error number in a file operation.
--15T01::.001411Z [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
--15T01::.001417Z [ERROR] InnoDB: Operating system error number in a file operation.
--15T01::.001421Z [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
--15T01::.001427Z [ERROR] InnoDB: Cannot open datafile './ibdata1'
--15T01::.001433Z [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
--15T01::.001439Z [ERROR] InnoDB: InnoDB Database creation was aborted with error Cannot open a file. You may need to delete the ibdata1 file before trying to start up again.
--15T01::.602600Z [ERROR] Plugin 'InnoDB' init function returned error.
--15T01::.602658Z [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
--15T01::.602666Z [ERROR] Failed to initialize builtin plugins.
--15T01::.602670Z [ERROR] Aborting --15T01::.602679Z [Note] Binlog end
--15T01::.603033Z [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
通过配置文件 my.cnf 查看数据文件 ibdata1 路径 ,发现实际文件不在
[root@centos74-tmp mysql]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
[root@centos74-tmp mysql]# cd /var/lib/mysql/data/ibdata1
-bash: cd: /var/lib/mysql/data/ibdata1: No such file or directory
通过 find 命令找到数据文件 ibdata1 实际目录,并修改配置文件 my.cnf
[root@centos74-tmp mysql]# find / -name ibdata*
/usr/local/mysql/data/ibdata1
[root@centos74-tmp mysql]# vim /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data/
socket=/var/lib/mysql/mysql.sock
再次尝试启动MySQL,发现端口一会就没了
[root@centos74-tmp mysql]# service mysqld start
Starting MySQL SUCCESS!
[root@centos74-tmp bin]# netstat -lnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN
tcp6 0 0 :::3306 :::* LISTEN
tcp6 0 0 :::4118 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
[root@centos74-tmp bin]# netstat -lnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN
tcp6 0 0 :::4118 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
再次查看MySQL日志,发现不能创建 mysql.sock.lock 文件
--15T01::.178424Z [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
--15T01::.178562Z [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
--15T01::.178599Z [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.) starting as process ...
--15T01::.184805Z [Note] InnoDB: PUNCH HOLE support available
--15T01::.184848Z [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
--15T01::.184854Z [Note] InnoDB: Uses event mutexes
--15T01::.184860Z [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
--15T01::.184864Z [Note] InnoDB: Compressed tables use zlib 1.2.
--15T01::.184869Z [Note] InnoDB: Using Linux native AIO
--15T01::.185282Z [Note] InnoDB: Number of pools:
--15T01::.185458Z [Note] InnoDB: Using CPU crc32 instructions
--15T01::.187568Z [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = , chunk size = 128M
--15T01::.197993Z [Note] InnoDB: Completed initialization of buffer pool
--15T01::.202453Z [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
--15T01::.330706Z [Note] InnoDB: Highest supported file format is Barracuda.
--15T01::.338353Z [Note] InnoDB: Log scan progressed past the checkpoint lsn
--15T01::.338438Z [Note] InnoDB: Doing recovery: scanned up to log sequence number
--15T01::.338470Z [Note] InnoDB: Database was not shutdown normally!
--15T01::.338490Z [Note] InnoDB: Starting crash recovery.
--15T01::.702763Z [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
--15T01::.702868Z [Note] InnoDB: Creating shared tablespace for temporary tables
--15T01::.702998Z [Note] InnoDB: Setting file './ibtmp1' size to MB. Physically writing the file full; Please wait ...
--15T01::.831707Z [Note] InnoDB: File './ibtmp1' size is now MB.
--15T01::.836313Z [Note] InnoDB: redo rollback segment(s) found. redo rollback segment(s) are active.
--15T01::.836353Z [Note] InnoDB: non-redo rollback segment(s) are active.
--15T01::.838015Z [Note] InnoDB: Waiting for purge to start
--15T01::.888404Z [Note] InnoDB: 5.7. started; log sequence number
--15T01::.890016Z [Note] InnoDB: Loading buffer pool(s) from /usr/local/mysql/data/ib_buffer_pool
--15T01::.916045Z [Note] Plugin 'FEDERATED' is disabled.
--15T01::.964452Z [Note] InnoDB: Buffer pool(s) load completed at ::
--15T01::.009629Z [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
--15T01::.009838Z [Warning] Failed to set up SSL because of the following SSL library error: SSL_CTX_set_default_verify_paths failed
--15T01::.010380Z [Note] Server hostname (bind-address): '*'; port:
--15T01::.010529Z [Note] IPv6 is available.
--15T01::.010552Z [Note] - '::' resolves to '::';
--15T01::.010588Z [Note] Server socket created on IP: '::'.
--15T01::.010733Z [ERROR] Could not create unix socket lock file /var/lib/mysql/mysql.sock.lock.
--15T01::.010746Z [ERROR] Unable to setup unix socket lock file.
--15T01::.010755Z [ERROR] Aborting
查看文件夹权限,发现属主为root,修改为mysql
[root@centos74-tmp mysql]# ll /var/lib/
total 4
……
drwxr-xr-x 2 root root 6 Jun 15 09:44 mysql
……
[root@centos74-tmp mysql]# chown mysql.mysql -R /var/lib/mysql/
[root@centos74-tmp mysql]# ll /var/lib/
total 4
……
drwxr-xr-x 2 mysql mysql 47 Jun 15 09:53 mysql
……
再次尝试重启MySQL,发现启动成功!!!
[root@centos74-tmp mysql]# service mysqld start
service mysqld start
Starting MySQL. SUCCESS!
[root@centos74-tmp mysql]# netstat -lnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN
tcp6 0 0 :::3306 :::* LISTEN
tcp6 0 0 :::4118 :::* LISTEN
tcp6 0 0 :::22
[root@centos74-tmp mysql]# vim /var/log/mariadb/mariadb.log
2019--15T01::.010780Z [Note] Binlog end
--15T01::.010938Z [Note] Shutting down plugin 'ngram'
--15T01::.010973Z [Note] Shutting down plugin 'ARCHIVE'
--15T01::.010984Z [Note] Shutting down plugin 'partition'
--15T01::.010992Z [Note] Shutting down plugin 'BLACKHOLE'
--15T01::.011002Z [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
--15T01::.011161Z [Note] Shutting down plugin 'CSV'
--15T01::.011175Z [Note] Shutting down plugin 'MEMORY'
--15T01::.011196Z [Note] Shutting down plugin 'MRG_MYISAM'
--15T01::.011216Z [Note] Shutting down plugin 'MyISAM'
--15T01::.011786Z [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
--15T01::.011817Z [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
--15T01::.011833Z [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
--15T01::.011838Z [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
--15T01::.011842Z [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
--15T01::.011846Z [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
--15T01::.011851Z [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
--15T01::.011855Z [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
--15T01::.011859Z [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
--15T01::.011864Z [Note] Shutting down plugin 'INNODB_SYS_TABLES'
--15T01::.011868Z [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
--15T01::.011872Z [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
--15T01::.011876Z [Note] Shutting down plugin 'INNODB_FT_CONFIG'
--15T01::.011880Z [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
--15T01::.011885Z [Note] Shutting down plugin 'INNODB_FT_DELETED'
--15T01::.011889Z [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
--15T01::.011893Z [Note] Shutting down plugin 'INNODB_METRICS'
--15T01::.011897Z [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
--15T01::.011901Z [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
--15T01::.011906Z [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
--15T01::.011910Z [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
--15T01::.011914Z [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
--15T01::.011919Z [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
--15T01::.011923Z [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
--15T01::.011927Z [Note] Shutting down plugin 'INNODB_CMPMEM'
--15T01::.011947Z [Note] Shutting down plugin 'INNODB_CMP_RESET'
--15T01::.011952Z [Note] Shutting down plugin 'INNODB_CMP'
--15T01::.011956Z [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
--15T01::.011961Z [Note] Shutting down plugin 'INNODB_LOCKS'
--15T01::.011965Z [Note] Shutting down plugin 'INNODB_TRX'
--15T01::.011969Z [Note] Shutting down plugin 'InnoDB'
--15T01::.012134Z [Note] InnoDB: FTS optimize thread exiting.
--15T01::.012281Z [Note] InnoDB: Starting shutdown...
--15T01::.112614Z [Note] InnoDB: Dumping buffer pool(s) to /usr/local/mysql/data/ib_buffer_pool
--15T01::.117111Z [Note] InnoDB: Buffer pool(s) dump completed at ::
--15T01::.836575Z [Note] InnoDB: Shutdown completed; log sequence number
--15T01::.839893Z [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
--15T01::.839924Z [Note] Shutting down plugin 'sha256_password'
--15T01::.839932Z [Note] Shutting down plugin 'mysql_native_password'
--15T01::.840120Z [Note] Shutting down plugin 'binlog'
--15T01::.840407Z [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
—— 以上仅为我个人遇到的情况,可能会有所不同,请根据实际情况,依据日志报错一个个处理。
【解决】MySQL提示启动成功,实际进程并没有起来的更多相关文章
- VS2017装了西红柿插件之后,启动很多次才能启动成功,进程有很多devenv.exe但是就是无法启动成功
VS2017装了西红柿插件之后,启动很多次才能启动成功,进程有很多devenv.exe但是就是无法启动成功,这个可能是西红柿插件visual assist的问题 启动vs命令行 输入: devenv ...
- MySQL:解决MySQL无法启动的问题
MySQL无法启动的原因有多种,这里是我遇到的一种情况和解决方法. 起因: 最近项目需要使用MySQL,于是想在MAC上安装一个本地的数据库,但是其实忘了已经安装过一个版本了,结果发现新的服务器怎么也 ...
- 解决mysql提示服务无法启动问题
1.管理员权限打开命令,进入mysql下bin文件夹 删除根目录下data文件夹没有不用管,重新安装 2. ---------------------------------------------- ...
- 解决MySQL服务启动时报1067错误
工具/原料 MySQL_5.6.24_win32 方法/步骤 当我们安装完Mysql时,如果在服务当中(可以在“运行”-->"service.msc"打开并查看)无法看到My ...
- docker相关----解决tomcat容器启动成功,无法访问的问题
使用docker安装了tomcat镜像,默认为latest最新的(8.5.50版本),依据tomcat镜像创建容器并同时做了端口映射 命令为:docker run --name tomcat01 -d ...
- 破解windows下MySQL服务启动不了的情况下不能对其进行全然卸载的解决方式
下面的文章主要介绍的是在MySQL服务启动不了的情况下,不能对其进行全然卸载的实际解决的方法的描写叙述,下面就是对解决MySQL服务启动不了的情况下详细方案的描写叙述,希望在你今后的学习中会对你有所帮 ...
- 解决Mysql因内存不足启动失败的问题
参考:https://www.jb51.net/article/136432.htm 一.查看内存 free -h free -m 二.解决方法: 1.增加swap交换空间解决问题: dd if=/d ...
- 本地服务开启MySQL57提示本地计算机上MySQL服务启动后停止。。。。
1.首先以管理员身份启动cmd,要不然服务禁止访问. 2.然后在cmd中输入 mysqld --remove mysql或者mysqld --remove mysql57来移除服务. 3.然后进入My ...
- MySQL Study之--Mysql无法启动“mysql.host”
MySQL Study之--Mysql无法启动"mysql.host" 系统环境: 操作系统:RedHat EL55 DB Soft: Mysql 5.6.4-m7 通过源代码包 ...
随机推荐
- CCF-CSP题解 201503-4 网络延时
求树的直径. 两遍\(dfs\)就好了. #include <cstdio> #include <cstring> #include <algorithm> #in ...
- SQL- SQL插入与更新删除
一 前言 经过之前的 [SQL]-SQL介绍, [SQL]- SQL检索阶段一, [SQL]-sql检索阶段二 的三篇文章你已经学会的sql的相关概念和如何查询数据库,这篇文章主要后续对数据库表的进入 ...
- springmvc源码学习
1.springmvc运行流程 流程图是直接在百度图片中找的一张 >.前台发送请求,请求会首先通过DispatcherServlet进行url的匹配;如果匹配不到,看是否配置<mvc: ...
- Nginx代理缓存功能
Nginx代理缓存功能 Nginx缓存主要是用于减轻后端服务器的负载,提高网站并发量,提升用户体验度. 注意:Nginx反向代理的缓存功能是由ngx_http_proxy_module提供, ...
- SpringBoot系列之集成logback实现日志打印(篇二)
SpringBoot系列之集成logback实现日志打印(篇二) 基于上篇博客SpringBoot系列之集成logback实现日志打印(篇一)之后,再写一篇博客进行补充 logback是一款开源的日志 ...
- 在Chrome 中使用Vimium
原文连接:https://blog.csdn.net/wuxianjiezh/article/details/91848604 Vimium:像在 Vim 中一样使用 Chrome 安装 使用方法 在 ...
- CSS 选择器、字体/文本、背景
CSS的基本使用 直接写在标签内 <p style="color: red; font-size: 40px;">段落</p> 写在 style 标签内 & ...
- Gradle 自定义插件
使用版本 5.6.2 插件被用来封装构建逻辑和一些通用配置.将可重复使用的构建逻辑和默认约定封装到插件里,以便于其他项目使用. 你可以使用你喜欢的语言开发插件,但是最终是要编译成字节码在 JVM 运行 ...
- 深度学习优质学习项目大放送!-AI Studio精选开源项目合集推荐
近期 在AI Studio上发现了不少优质的开源深度学习项目,从深度学习入门到进阶,涵盖了CV.NLP.生成对抗网络.强化学习多个研究方向,还有最新的动态图,都以NoteBook的方式直接开源出来,并 ...
- RN配置 java和python环境
安装java JDK 不推荐更改安装路径. 安装时 不要有中文 会安装jdK和jre 1==>配置新建 JAVA_HOME 具体是[编辑]==>[新建] 然后添加下两句 JAVA_HOME ...