一、概括:

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提示启动成功,实际进程并没有起来的更多相关文章

  1. VS2017装了西红柿插件之后,启动很多次才能启动成功,进程有很多devenv.exe但是就是无法启动成功

    VS2017装了西红柿插件之后,启动很多次才能启动成功,进程有很多devenv.exe但是就是无法启动成功,这个可能是西红柿插件visual assist的问题 启动vs命令行 输入: devenv ...

  2. MySQL:解决MySQL无法启动的问题

    MySQL无法启动的原因有多种,这里是我遇到的一种情况和解决方法. 起因: 最近项目需要使用MySQL,于是想在MAC上安装一个本地的数据库,但是其实忘了已经安装过一个版本了,结果发现新的服务器怎么也 ...

  3. 解决mysql提示服务无法启动问题

    1.管理员权限打开命令,进入mysql下bin文件夹 删除根目录下data文件夹没有不用管,重新安装 2. ---------------------------------------------- ...

  4. 解决MySQL服务启动时报1067错误

    工具/原料 MySQL_5.6.24_win32 方法/步骤 当我们安装完Mysql时,如果在服务当中(可以在“运行”-->"service.msc"打开并查看)无法看到My ...

  5. docker相关----解决tomcat容器启动成功,无法访问的问题

    使用docker安装了tomcat镜像,默认为latest最新的(8.5.50版本),依据tomcat镜像创建容器并同时做了端口映射 命令为:docker run --name tomcat01 -d ...

  6. 破解windows下MySQL服务启动不了的情况下不能对其进行全然卸载的解决方式

    下面的文章主要介绍的是在MySQL服务启动不了的情况下,不能对其进行全然卸载的实际解决的方法的描写叙述,下面就是对解决MySQL服务启动不了的情况下详细方案的描写叙述,希望在你今后的学习中会对你有所帮 ...

  7. 解决Mysql因内存不足启动失败的问题

    参考:https://www.jb51.net/article/136432.htm 一.查看内存 free -h free -m 二.解决方法: 1.增加swap交换空间解决问题: dd if=/d ...

  8. 本地服务开启MySQL57提示本地计算机上MySQL服务启动后停止。。。。

    1.首先以管理员身份启动cmd,要不然服务禁止访问. 2.然后在cmd中输入 mysqld --remove mysql或者mysqld --remove mysql57来移除服务. 3.然后进入My ...

  9. MySQL Study之--Mysql无法启动“mysql.host”

    MySQL Study之--Mysql无法启动"mysql.host" 系统环境: 操作系统:RedHat EL55 DB Soft:  Mysql 5.6.4-m7 通过源代码包 ...

随机推荐

  1. JavaFX如何为按钮设置快捷键?

    JavaFX为按钮设置快捷键的方式有很多,先说下常见的一种. 第一种: KeyCodeCombination kc1 = new KeyCodeCombination(KeyCode.W, KeyCo ...

  2. Oracle trunc函数的使用

    1. 对日期的操作 2. 对数字的操作 1.对日期的操作 /**************日期********************/ SELECT TRUNC(SYSDATE) FROM DUAL; ...

  3. VMware Workstation 15 Pro中安装ubuntu1804

    这篇笔记是一篇安装教程,没有什么实际的意义,仅为了记录一下……距离上次弄这东西不知道多长时间了,以至于这次再次使用时很是生疏,于是就想着把过程记录下来方便之后查看. 这里不涉及VMware Works ...

  4. Flask 模板语言,装饰器

      Jinja2模板语言 # -*- coding: utf-8 -*-   from flask import Flask, render_template, request, redirect,  ...

  5. Class文件结构-实例学习笔记

  6. Geoserver发布服务

    Geoserver发布服务的数据源很多样化 在数据存储中选择要发布的数据来源,这里以POSTGIS为例 1. 2.如果成功,就会读取出库里面的表,你可以在这里添加图层,发布服务 3.点击发布,进行服务 ...

  7. 2018年Code Review状态报告

    Code Review 代码评审是指在软件开发过程中,对源代码的系统性检查.通常的目的是查找系统缺陷,保证软件总体质量和提高开发者自身水平. Code Review是轻量级代码评审,相对于正式代码评审 ...

  8. 追踪SQL Server执行delete操作时候不同锁申请与释放的过程

    一直以为很了解sqlserver的加锁过程,在分析一些特殊情况下的死锁之后,尤其是并发单表操作发生的死锁,对于加解锁的过程,有了一些重新的认识,之前的知识还是有一些盲区在里面的.delete加锁与解锁 ...

  9. ORA-27468: ""."" is locked by another process

    You have a scheduler job that generated an error. When the error occurred, you attempted to disable ...

  10. GNN 相关资料记录;GCN 与 graph embedding 相关调研

    最近做了一些和gnn相关的工作,经常听到GCN 和 embedding 相关技术,感觉很是困惑,所以写下此博客,对相关知识进行索引和记录: 参考链接: https://www.toutiao.com/ ...