问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

mysql 显示已启动,但是进程里找不到

发布网友 发布时间:2022-05-02 20:57

我来回答

2个回答

懂视网 时间:2022-05-03 01:18

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
2019-06-15T01:38:41.969191Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-06-15T01:38:41.969334Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2019-06-15T01:38:41.969372Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.22) starting as process 32707 ...
2019-06-15T01:38:41.976201Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-06-15T01:38:41.976243Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-06-15T01:38:41.976249Z 0 [Note] InnoDB: Uses event mutexes
2019-06-15T01:38:41.976267Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2019-06-15T01:38:41.976272Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2019-06-15T01:38:41.976277Z 0 [Note] InnoDB: Using Linux native AIO
2019-06-15T01:38:41.976564Z 0 [Note] InnoDB: Number of pools: 1
2019-06-15T01:38:41.976689Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-06-15T01:38:41.978521Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-06-15T01:38:41.988017Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-06-15T01:38:41.991091Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-06-15T01:38:42.001066Z 0 [Note] InnoDB: The first innodb_system data file ‘ibdata1‘ did not exist. A new tablespace will be created!
2019-06-15T01:38:42.001400Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2019-06-15T01:38:42.001411Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2019-06-15T01:38:42.001417Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2019-06-15T01:38:42.001421Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2019-06-15T01:38:42.001427Z 0 [ERROR] InnoDB: Cannot open datafile ‘./ibdata1‘
2019-06-15T01:38:42.001433Z 0 [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!
2019-06-15T01:38:42.001439Z 0 [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.
2019-06-15T01:38:42.602600Z 0 [ERROR] Plugin ‘InnoDB‘ init function returned error.
2019-06-15T01:38:42.602658Z 0 [ERROR] Plugin ‘InnoDB‘ registration as a STORAGE ENGINE failed.
2019-06-15T01:38:42.602666Z 0 [ERROR] Failed to initialize builtin plugins.
2019-06-15T01:38:42.602670Z 0 [ERROR] Aborting

2019-06-15T01:38:42.602679Z 0 [Note] Binlog end
2019-06-15T01:38:42.603033Z 0 [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 文件

2019-06-15T01:49:41.178424Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-06-15T01:49:41.178562Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2019-06-15T01:49:41.178599Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.22) starting as process 2650 ...
2019-06-15T01:49:41.184805Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-06-15T01:49:41.184848Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-06-15T01:49:41.184854Z 0 [Note] InnoDB: Uses event mutexes
2019-06-15T01:49:41.184860Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2019-06-15T01:49:41.184864Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2019-06-15T01:49:41.184869Z 0 [Note] InnoDB: Using Linux native AIO
2019-06-15T01:49:41.185282Z 0 [Note] InnoDB: Number of pools: 1
2019-06-15T01:49:41.185458Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-06-15T01:49:41.187568Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-06-15T01:49:41.197993Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-06-15T01:49:41.202453Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-06-15T01:49:41.330706Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-06-15T01:49:41.338353Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 360871592
2019-06-15T01:49:41.338438Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 360871601
2019-06-15T01:49:41.338470Z 0 [Note] InnoDB: Database was not shutdown normally!
2019-06-15T01:49:41.338490Z 0 [Note] InnoDB: Starting crash recovery.
2019-06-15T01:49:43.702763Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2019-06-15T01:49:43.702868Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-06-15T01:49:43.702998Z 0 [Note] InnoDB: Setting file ‘./ibtmp1‘ size to 12 MB. Physically writing the file full; Please wait ...
2019-06-15T01:49:43.831707Z 0 [Note] InnoDB: File ‘./ibtmp1‘ size is now 12 MB.
2019-06-15T01:49:43.836313Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2019-06-15T01:49:43.836353Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2019-06-15T01:49:43.838015Z 0 [Note] InnoDB: Waiting for purge to start
2019-06-15T01:49:43.888404Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 360871601
2019-06-15T01:49:43.890016Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/mysql/data/ib_buffer_pool
2019-06-15T01:49:43.916045Z 0 [Note] Plugin ‘FEDERATED‘ is disabled.
2019-06-15T01:49:43.964452Z 0 [Note] InnoDB: Buffer pool(s) load completed at 190615 9:49:43
2019-06-15T01:49:44.009629Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2019-06-15T01:49:44.009838Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL_CTX_set_default_verify_paths failed
2019-06-15T01:49:44.010380Z 0 [Note] Server hostname (bind-address): ‘*‘; port: 3306
2019-06-15T01:49:44.010529Z 0 [Note] IPv6 is available.
2019-06-15T01:49:44.010552Z 0 [Note] - ‘::‘ resolves to ‘::‘;
2019-06-15T01:49:44.010588Z 0 [Note] Server socket created on IP: ‘::‘.
2019-06-15T01:49:44.010733Z 0 [ERROR] Could not create unix socket lock file /var/lib/mysql/mysql.sock.lock.
2019-06-15T01:49:44.010746Z 0 [ERROR] Unable to setup unix socket lock file.
2019-06-15T01:49:44.010755Z 0 [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-06-15T01:49:44.010780Z 0 [Note] Binlog end 2019-06-15T01:49:44.010938Z 0 [Note] Shutting down plugin ‘ngram‘ 2019-06-15T01:49:44.010973Z 0 [Note] Shutting down plugin ‘ARCHIVE‘ 2019-06-15T01:49:44.010984Z 0 [Note] Shutting down plugin ‘partition‘ 2019-06-15T01:49:44.010992Z 0 [Note] Shutting down plugin ‘BLACKHOLE‘ 2019-06-15T01:49:44.011002Z 0 [Note] Shutting down plugin ‘PERFORMANCE_SCHEMA‘ 2019-06-15T01:49:44.011161Z 0 [Note] Shutting down plugin ‘CSV‘ 2019-06-15T01:49:44.011175Z 0 [Note] Shutting down plugin ‘MEMORY‘ 2019-06-15T01:49:44.011196Z 0 [Note] Shutting down plugin ‘MRG_MYISAM‘ 2019-06-15T01:49:44.011216Z 0 [Note] Shutting down plugin ‘MyISAM‘ 2019-06-15T01:49:44.011786Z 0 [Note] Shutting down plugin ‘INNODB_SYS_VIRTUAL‘ 2019-06-15T01:49:44.011817Z 0 [Note] Shutting down plugin ‘INNODB_SYS_DATAFILES‘ 2019-06-15T01:49:44.011833Z 0 [Note] Shutting down plugin ‘INNODB_SYS_TABLESPACES‘ 2019-06-15T01:49:44.011838Z 0 [Note] Shutting down plugin ‘INNODB_SYS_FOREIGN_COLS‘ 2019-06-15T01:49:44.011842Z 0 [Note] Shutting down plugin ‘INNODB_SYS_FOREIGN‘ 2019-06-15T01:49:44.011846Z 0 [Note] Shutting down plugin ‘INNODB_SYS_FIELDS‘ 2019-06-15T01:49:44.011851Z 0 [Note] Shutting down plugin ‘INNODB_SYS_COLUMNS‘ 2019-06-15T01:49:44.011855Z 0 [Note] Shutting down plugin ‘INNODB_SYS_INDEXES‘ 2019-06-15T01:49:44.011859Z 0 [Note] Shutting down plugin ‘INNODB_SYS_TABLESTATS‘ 2019-06-15T01:49:44.011864Z 0 [Note] Shutting down plugin ‘INNODB_SYS_TABLES‘ 2019-06-15T01:49:44.011868Z 0 [Note] Shutting down plugin ‘INNODB_FT_INDEX_TABLE‘ 2019-06-15T01:49:44.011872Z 0 [Note] Shutting down plugin ‘INNODB_FT_INDEX_CACHE‘ 2019-06-15T01:49:44.011876Z 0 [Note] Shutting down plugin ‘INNODB_FT_CONFIG‘ 2019-06-15T01:49:44.011880Z 0 [Note] Shutting down plugin ‘INNODB_FT_BEING_DELETED‘ 2019-06-15T01:49:44.011885Z 0 [Note] Shutting down plugin ‘INNODB_FT_DELETED‘ 2019-06-15T01:49:44.011889Z 0 [Note] Shutting down plugin ‘INNODB_FT_DEFAULT_STOPWORD‘ 2019-06-15T01:49:44.011893Z 0 [Note] Shutting down plugin ‘INNODB_METRICS‘ 2019-06-15T01:49:44.011897Z 0 [Note] Shutting down plugin ‘INNODB_TEMP_TABLE_INFO‘ 2019-06-15T01:49:44.011901Z 0 [Note] Shutting down plugin ‘INNODB_BUFFER_POOL_STATS‘ 2019-06-15T01:49:44.011906Z 0 [Note] Shutting down plugin ‘INNODB_BUFFER_PAGE_LRU‘ 2019-06-15T01:49:44.011910Z 0 [Note] Shutting down plugin ‘INNODB_BUFFER_PAGE‘ 2019-06-15T01:49:44.011914Z 0 [Note] Shutting down plugin ‘INNODB_CMP_PER_INDEX_RESET‘ 2019-06-15T01:49:44.011919Z 0 [Note] Shutting down plugin ‘INNODB_CMP_PER_INDEX‘ 2019-06-15T01:49:44.011923Z 0 [Note] Shutting down plugin ‘INNODB_CMPMEM_RESET‘ 2019-06-15T01:49:44.011927Z 0 [Note] Shutting down plugin ‘INNODB_CMPMEM‘ 2019-06-15T01:49:44.011947Z 0 [Note] Shutting down plugin ‘INNODB_CMP_RESET‘ 2019-06-15T01:49:44.011952Z 0 [Note] Shutting down plugin ‘INNODB_CMP‘ 2019-06-15T01:49:44.011956Z 0 [Note] Shutting down plugin ‘INNODB_LOCK_WAITS‘ 2019-06-15T01:49:44.011961Z 0 [Note] Shutting down plugin ‘INNODB_LOCKS‘ 2019-06-15T01:49:44.011965Z 0 [Note] Shutting down plugin ‘INNODB_TRX‘ 2019-06-15T01:49:44.011969Z 0 [Note] Shutting down plugin ‘InnoDB‘ 2019-06-15T01:49:44.012134Z 0 [Note] InnoDB: FTS optimize thread exiting. 2019-06-15T01:49:44.012281Z 0 [Note] InnoDB: Starting shutdown... 2019-06-15T01:49:44.112614Z 0 [Note] InnoDB: Dumping buffer pool(s) to /usr/local/mysql/data/ib_buffer_pool 2019-06-15T01:49:44.117111Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 190615 9:49:44 2019-06-15T01:49:45.836575Z 0 [Note] InnoDB: Shutdown completed; log sequence number 360872741 2019-06-15T01:49:45.839893Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1" 2019-06-15T01:49:45.839924Z 0 [Note] Shutting down plugin ‘sha256_password‘ 2019-06-15T01:49:45.839932Z 0 [Note] Shutting down plugin ‘mysql_native_password‘ 2019-06-15T01:49:45.840120Z 0 [Note] Shutting down plugin ‘binlog‘ 2019-06-15T01:49:45.840407Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

 

—— 以上仅为我个人遇到的情况,可能会有所不同,请根据实际情况,依据日志报错一个个处理。

 

MySQL提示启动成功,实际进程并没有起来

标签:serve   internet   soc   ali   zed   -name   delete   exit   uda   

热心网友 时间:2022-05-02 22:26

如果是windows下,cmd中执行sc query mysql;看看mysql的状态是否是running
linux下,ps -ef|grep mysqld 看看是否有进程号
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
新生儿脐疝的诊断与鉴别 小儿脐疝发病原因 导致新生儿脐疝发作的原因有哪些? 腾讯视频2023年10月24日免费会员账号分享-腾讯视频2023年10月24日免 ... 百度网盘激活码免费领取2024 百度网盘激活码免费领取最新分享 我是男生 今年18周岁 我身高172是不是完蛋了 我还会长吗? 估计还能长... 开荒保洁一平米多少钱 物业开荒费用包括哪些 公司保洁开荒多少钱一平 开封灌汤包哪家正宗 开封哪家灌汤包最好吃 南北年夜饭因地域不同导致差异太大,都有什么差异? 年夜饭的研究背景怎么写? 示波器显示波形原理 简述示波器显示u-t图形的原理 如何打印竖版标题 夫冈何在是什么意思 书荒,来几个玄幻 修仙 斗气文. 高分,跪求,公主嫁到第2部剧情谁知道啊 老婆会删掉和男同事的聊天记录,我怎么办好? 夫纲不正是什么意思? 求签:四十八签 一重江水一重山 谁知此去路又难 任他振夫落一路 是非终久未得安 您好 女友小慧 周可反的全集有吗? 分享一下 嘻嘻 《我的女友小慧》免费阅读全文 搅拌站控制系统上传数据如何改动 急!急!我们想要更换下搅拌站的控制系统,请问北京华贝尔公司的PAC9.0怎么样? 混凝土搅拌站集中控制系统,怎么配料 哪家搅拌站控制系统好? 大家可以推荐一款搅拌站生产控制系统吗?谢了。 搅拌站控制系统 搅拌站控制系统为什么要升级? 苹果手机开过屏还值钱吗 ipad air2屏幕换过能卖多少钱 ipad4 换过屏幕能卖多少钱 ipadair2屏幕碎了 能卖多少钱 各位,现在iPad4换屏多少钱 iPad换屏幕多少钱?这还有救吗? 苹果ipad玻璃屏摔坏了,换个玻璃屏得多少钱 如何实施学校精细化管理 如何让精细化管理实施在教育教学中 精细化管理学校的几点做法 后勤部门如何设定管理目标? 学校后勤人员享有寒暑假吗 苹果手机访问限制密码忘记了怎么办 苹果手机访问限制密码不记得了怎么办 苹果手机访问受限制密码忘记了怎么办 苹果手机访问限制,忘记密码怎么办? 花螺是寒性食物吗 花螺哪些人不能吃 花螺买回来后死了还能吃吗? mysql 显示已启动,但是进程里找不到! 看图!花螺这个像寄生虫一样的是什么?能吃吗?