찾다
데이터 베이스MySQL 튜토리얼MySQL启动故障处理一例(errno13)_MySQL

之前在系统上装了个MySQL用于测试,今天发现启动mysqld_safe进程的时候报错,如下所示:
[root@bak local]# mysqld_safe & [1] 2631 [root@bak local]# Starting mysqld daemon with databases from /data/mysql/mysql_3306/data STOPPING server from pid file /data/mysql/mysql_3306/data/bak.pid 141017 09:20:23 mysqld ended

[1]+ Done mysqld_safe
由于我的my.cnf并没有改名,使用的是默认的/etc/my.cnf这个位置,因此mysqld_safe &可以不用指定任何参数,需要的参数已经在my.cnf中指定了,如果使用的my.cnf位置不在/etc/下面,或者改过了自定义的名字,那么需要用--defaults-file参数来指定my.cnf文件的位置
[root@bak local]# cd /data/mysql/mysql_3306/logs/ [root@bak logs]# ll total 0
查看日志,并没有任何binlog生成,这里说明一下,这个环境是从原来的一台主机上clone过来的,clone完以后没有启动过MySQL,我想可能是因为这个缘故
[root@bak mysql_3306]# cd /usr/local
[root@bak local]# chown -R mysql:mysql /data/mysql/
[root@bak local]# chown -R mysql:mysql /usr/local/mysql/ [root@bak local]# ll total 76 drwxr-xr-x 2 mysql 502 4096 Aug 25 11:39 bin -rw-rw---- 1 mysql root 432 Oct 17 09:20 error.log drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 etc drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 games drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 include drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 lib drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 libexec lrwxrwxrwx 1 root root 38 Sep 24 00:12 mysql -> /opt/mysql/mysql-5.5.39-linux2.6-i686/ drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 sbin drwxr-xr-x 5 mysql 502 4096 Aug 25 11:39 share drwxr-xr-x 2 mysql 502 4096 Sep 23 20:34 src
[root@bak local]# id mysql uid=501(mysql) gid=1000(mysql) groups=1000(mysql) mysql用户id为501,但不知为何显示的是mysql 502的形式,而不是mysql mysql
开始以为是因为/usr/local/mysql这个目录是root:root的缘故,但改为mysql:mysql后,依然无法启动
[root@bak data]# chown -R mysql:mysql /usr/local [root@bak data]# cd /usr/local [root@bak local]# ll total 76 drwxr-xr-x 2 mysql 502 4096 Aug 25 11:39 bin -rw-rw---- 1 mysql root 432 Oct 17 09:20 error.log drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 etc drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 games drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 include drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 lib drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 libexec lrwxrwxrwx 1 mysql mysql 38 Sep 24 00:12 mysql -> /opt/mysql/mysql-5.5.39-linux2.6-i686/ drwxr-xr-x 2 mysql 502 4096 Aug 8 2008 sbin drwxr-xr-x 5 mysql 502 4096 Aug 25 11:39 share drwxr-xr-x 2 mysql 502 4096 Sep 23 20:34 src [root@bak local]# mysqld_safe & [1] 2692 [root@bak local]# Starting mysqld daemon with databases from /data/mysql/mysql_3306/data
[root@bak local]# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
报了一个无法通过socket连接到服务器,于是想是不是应该在client项目中添加socket=/tmp/mysql.sock这个参数
--先查看下原来有的配置 [root@bak local]# cat /etc/my.cnf [client] port = 3306 socket = /tmp/mysql.sock
[mysqld_safe] open_files_limit = 8192 user = mysql log-error = error.log
...省略以下部分
看来client总已经指定了socket,应该不是这个问题,要判断问题出在哪里,最直接都就是查看error.log文件,由于我在my.cnf参数中指定了error.log的位置,放在了数据文件目录下,并更改了名字。如果没有改,默认的名字为.error
[root@bak local]# cat /data/mysql/mysql_3306/data/error.log 141017 9:24:53 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
141017 9:24:53 [Note] Plugin 'FEDERATED' is disabled. /usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist 141017 9:24:53 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 141017 9:24:53 InnoDB: The InnoDB memory heap is disabled 141017 9:24:53 InnoDB: Mutexes and rw_locks use InnoDB's own implementation 141017 9:24:53 InnoDB: Compressed tables use zlib 1.2.3 141017 9:24:53 InnoDB: Using Linux native AIO 141017 9:24:53 InnoDB: Initializing buffer pool, size = 128.0M 141017 9:24:53 InnoDB: Completed initialization of buffer pool InnoDB: The first specified data file ./ibdata1 did not exist: InnoDB: a new database to be created! 141017 9:24:53 InnoDB: Setting file ./ibdata1 size to 100 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 141017 9:24:58 InnoDB: Log file ./ib_logfile0 did not exist: new to be created InnoDB: Setting log file ./ib_logfile0 size to 100 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 141017 9:25:03 InnoDB: Log file ./ib_logfile1 did not exist: new to be created InnoDB: Setting log file ./ib_logfile1 size to 100 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 141017 9:25:08 InnoDB: Log file ./ib_logfile2 did not exist: new to be created InnoDB: Setting log file ./ib_logfile2 size to 100 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 InnoDB: Doublewrite buffer not found: creating new InnoDB: Doublewrite buffer created InnoDB: 127 rollback segment(s) active. InnoDB: Creating foreign key constraint system tables InnoDB: Foreign key constraint system tables created 141017 9:25:13 InnoDB: Waiting for the background threads to start 141017 9:25:14 InnoDB: 5.5.39 started; log sequence number 0 141017 9:25:14 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 141017 9:25:14 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 141017 9:25:14 [Note] Server socket created on IP: '0.0.0.0'. 141017 9:25:14 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 141017 9:26:15 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 141017 9:26:15 [Note] Plugin 'FEDERATED' is disabled. /usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist 141017 9:26:15 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 141017 9:26:15 InnoDB: The InnoDB memory heap is disabled 141017 9:26:15 InnoDB: Mutexes and rw_locks use InnoDB's own implementation 141017 9:26:15 InnoDB: Compressed tables use zlib 1.2.3 141017 9:26:15 InnoDB: Using Linux native AIO 141017 9:26:15 InnoDB: Initializing buffer pool, size = 128.0M 141017 9:26:15 InnoDB: Completed initialization of buffer pool 141017 9:26:15 InnoDB: highest supported file format is Barracuda. InnoDB: Log scan progressed past the checkpoint lsn 48941 141017 9:26:15 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... InnoDB: Doing recovery: scanned up to log sequence number 1595668 141017 9:26:15 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed 141017 9:26:15 InnoDB: Waiting for the background threads to start 141017 9:26:16 InnoDB: 5.5.39 started; log sequence number 1595668 141017 9:26:16 [Note] Recovering after a crash using /data/mysql/mysql_3306/logs/mysql-bin 141017 9:26:16 [Note] Starting crash recovery... 141017 9:26:16 [Note] Crash recovery finished. 141017 9:26:17 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 141017 9:26:17 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 141017 9:26:17 [Note] Server socket created on IP: '0.0.0.0'. 141017 9:26:17 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
日志中报错提示无法打开mysql.plugin表,也不存在mysql.host这张表,由于是测试环境,没有什么数据,于是决定重新初始化MySQL
[root@bak local]# cd mysql
[root@bak mysql]# ./scripts/mysql_install_db Installing MySQL system tables... 141017 9:28:24 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set OK Filling help tables... 141017 9:28:25 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set OK
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password' /usr/local/mysql/bin/mysqladmin -u root -h bak password 'new-password'
Alternatively you can run: /usr/local/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with: cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
[root@bak mysql]# mysqld_safe & [1] 2858 [root@bak mysql]# Starting mysqld daemon with databases from /data/mysql/mysql_3306/data
[root@bak mysql]# mysqSTOPPING server from pid file /data/mysql/mysql_3306/data/bak.pid l141017 09:28:36 mysqld ended

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) [1]+ Done mysqld_safe
初始化时成功的,可以看到有2个OK,不过启动依然报错,再次查看error.log
[root@bak mysql]# cat /data/mysql/mysql_3306/data/error.log 141017 9:24:53 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 141017 9:24:53 [Note] Plugin 'FEDERATED' is disabled. /usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist 141017 9:24:53 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 141017 9:24:53 InnoDB: The InnoDB memory heap is disabled 141017 9:24:53 InnoDB: Mutexes and rw_locks use InnoDB's own implementation 141017 9:24:53 InnoDB: Compressed tables use zlib 1.2.3 141017 9:24:53 InnoDB: Using Linux native AIO 141017 9:24:53 InnoDB: Initializing buffer pool, size = 128.0M 141017 9:24:53 InnoDB: Completed initialization of buffer pool InnoDB: The first specified data file ./ibdata1 did not exist: InnoDB: a new database to be created! 141017 9:24:53 InnoDB: Setting file ./ibdata1 size to 100 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 141017 9:24:58 InnoDB: Log file ./ib_logfile0 did not exist: new to be created InnoDB: Setting log file ./ib_logfile0 size to 100 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 141017 9:25:03 InnoDB: Log file ./ib_logfile1 did not exist: new to be created InnoDB: Setting log file ./ib_logfile1 size to 100 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 141017 9:25:08 InnoDB: Log file ./ib_logfile2 did not exist: new to be created InnoDB: Setting log file ./ib_logfile2 size to 100 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 InnoDB: Doublewrite buffer not found: creating new InnoDB: Doublewrite buffer created InnoDB: 127 rollback segment(s) active. InnoDB: Creating foreign key constraint system tables InnoDB: Foreign key constraint system tables created 141017 9:25:13 InnoDB: Waiting for the background threads to start 141017 9:25:14 InnoDB: 5.5.39 started; log sequence number 0 141017 9:25:14 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 141017 9:25:14 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 141017 9:25:14 [Note] Server socket created on IP: '0.0.0.0'. 141017 9:25:14 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 141017 9:26:15 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 141017 9:26:15 [Note] Plugin 'FEDERATED' is disabled. /usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist 141017 9:26:15 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 141017 9:26:15 InnoDB: The InnoDB memory heap is disabled 141017 9:26:15 InnoDB: Mutexes and rw_locks use InnoDB's own implementation 141017 9:26:15 InnoDB: Compressed tables use zlib 1.2.3 141017 9:26:15 InnoDB: Using Linux native AIO 141017 9:26:15 InnoDB: Initializing buffer pool, size = 128.0M 141017 9:26:15 InnoDB: Completed initialization of buffer pool 141017 9:26:15 InnoDB: highest supported file format is Barracuda. InnoDB: Log scan progressed past the checkpoint lsn 48941 141017 9:26:15 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... InnoDB: Doing recovery: scanned up to log sequence number 1595668 141017 9:26:15 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed 141017 9:26:15 InnoDB: Waiting for the background threads to start 141017 9:26:16 InnoDB: 5.5.39 started; log sequence number 1595668 141017 9:26:16 [Note] Recovering after a crash using /data/mysql/mysql_3306/logs/mysql-bin 141017 9:26:16 [Note] Starting crash recovery... 141017 9:26:16 [Note] Crash recovery finished. 141017 9:26:17 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 141017 9:26:17 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 141017 9:26:17 [Note] Server socket created on IP: '0.0.0.0'. 141017 9:26:17 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 141017 9:28:34 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 141017 9:28:34 [Note] Plugin 'FEDERATED' is disabled. /usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13) 141017 9:28:34 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 141017 9:28:34 InnoDB: The InnoDB memory heap is disabled 141017 9:28:34 InnoDB: Mutexes and rw_locks use InnoDB's own implementation 141017 9:28:34 InnoDB: Compressed tables use zlib 1.2.3 141017 9:28:34 InnoDB: Using Linux native AIO 141017 9:28:34 InnoDB: Initializing buffer pool, size = 128.0M 141017 9:28:34 InnoDB: Completed initialization of buffer pool 141017 9:28:34 InnoDB: highest supported file format is Barracuda. InnoDB: The log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! 141017 9:28:34 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... 141017 9:28:34 InnoDB: Waiting for the background threads to start 141017 9:28:35 InnoDB: 5.5.39 started; log sequence number 1595668 /usr/libexec/mysqld: File '/data/mysql/mysql_3306/logs/mysql-bin.000004' not found (Errcode: 13) 141017 9:28:35 [ERROR] Failed to open log (file '/data/mysql/mysql_3306/logs/mysql-bin.000004', errno 13) 141017 9:28:35 [ERROR] Could not open log file 141017 9:28:35 [ERROR] Can't init tc log 141017 9:28:35 [ERROR] Aborting
141017 9:28:35 InnoDB: Starting shutdown... 141017 9:28:36 InnoDB: Shutdown completed; log sequence number 1595668 141017 9:28:36 [Note] /usr/libexec/mysqld: Shutdown complete
141017 9:30:32 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 141017 9:30:32 [Note] Plugin 'FEDERATED' is disabled. /usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13) 141017 9:30:32 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 141017 9:30:32 InnoDB: The InnoDB memory heap is disabled 141017 9:30:32 InnoDB: Mutexes and rw_locks use InnoDB's own implementation 141017 9:30:32 InnoDB: Compressed tables use zlib 1.2.3 141017 9:30:32 InnoDB: Using Linux native AIO 141017 9:30:32 InnoDB: Initializing buffer pool, size = 128.0M 141017 9:30:32 InnoDB: Completed initialization of buffer pool 141017 9:30:32 InnoDB: highest supported file format is Barracuda. 141017 9:30:32 InnoDB: Waiting for the background threads to start 141017 9:30:33 InnoDB: 5.5.39 started; log sequence number 1595668 /usr/libexec/mysqld: File '/data/mysql/mysql_3306/logs/mysql-bin.000004' not found (Errcode: 13) 141017 9:30:33 [ERROR] Failed to open log (file '/data/mysql/mysql_3306/logs/mysql-bin.000004', errno 13) 141017 9:30:33 [ERROR] Could not open log file 141017 9:30:33 [ERROR] Can't init tc log 141017 9:30:33 [ERROR] Aborting
141017 9:30:33 InnoDB: Starting shutdown... 141017 9:30:34 InnoDB: Shutdown completed; log sequence number 1595668 141017 9:30:34 [Note] /usr/libexec/mysqld: Shutdown complete
现在error.log里很明显地指出errno为13,我们知道13就是权限问题,这个可以perror命令查看 [root@bak mysql]# perror 13 OS error code 13: Permission denied
位置可以通过which来定位 [root@bak mysql]# which perror
/usr/bin/perror
或者用find定位也是可以的 [root@bak mysql]# find / -name perror -print
/opt/mysql/mysql-5.5.39-linux2.6-i686/bin/perror
/usr/bin/perror

既然找到了无法启动的真正原因,那么对症下药,把权限问题解决,问题就可以搞定了
[root@bak mysql]# cd /data/mysql/mysql_3306/data
[root@bak data]# ll total 410036 -rw-rw---- 1 mysql mysql 7950 Oct 17 09:30 error.log -rw-rw---- 1 mysql mysql 104857600 Oct 17 09:30 ibdata1 -rw-rw---- 1 mysql mysql 104857600 Oct 17 09:30 ib_logfile0 -rw-rw---- 1 mysql mysql 104857600 Oct 17 09:25 ib_logfile1 -rw-rw---- 1 mysql mysql 104857600 Oct 17 09:25 ib_logfile2 drwx------ 2 root root 4096 Oct 17 09:28 mysql drwx------ 2 root root 4096 Oct 17 09:28 performance_schema drwx------ 2 root root 4096 Oct 17 09:28 test [root@bak data]# chown -R mysql:mysql ./ [root@bak data]# ll total 410036 -rw-rw---- 1 mysql mysql 7950 Oct 17 09:30 error.log -rw-rw---- 1 mysql mysql 104857600 Oct 17 09:30 ibdata1 -rw-rw---- 1 mysql mysql 104857600 Oct 17 09:30 ib_logfile0 -rw-rw---- 1 mysql mysql 104857600 Oct 17 09:25 ib_logfile1 -rw-rw---- 1 mysql mysql 104857600 Oct 17 09:25 ib_logfile2 drwx------ 2 mysql mysql 4096 Oct 17 09:28 mysql drwx------ 2 mysql mysql 4096 Oct 17 09:28 performance_schema drwx------ 2 mysql mysql 4096 Oct 17 09:28 test
开始还去调整了/data/mysql/mysql_3306/data目录下面几个数据库的权限,但发现依然无法启动,看来不是这几个目录的权限问题

[root@bak data]# mysqld_safe & [1] 2988 [root@bak data]# Starting mysqld daemon with databases from /data/mysql/mysql_3306/data
[root@bak data]# mysqlSTOPPING server from pid file /data/mysql/mysql_3306/data/bak.pid 141017 09:32:08 mysqld ended

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) [1]+ Done mysqld_safe
error.log日志内容和之前一样,仍然报errno 13,就不贴了。针对之前给出的error.log日志里提示的对mysql-bin.000004读写权限的问题做一下处理
[root@bak mysql]# cd /data/mysql/mysql_3306/logs [root@bak logs]# ll total 1092 -rw-rw---- 1 mysql mysql 107 Oct 17 09:25 mysql-bin.000001 -rw-rw---- 1 mysql mysql 107 Oct 17 09:26 mysql-bin.000002 -rw-rw---- 1 root root 27681 Oct 17 09:28 mysql-bin.000003 -rw-rw---- 1 root root 1070549 Oct 17 09:28 mysql-bin.000004 -rw-rw---- 1 mysql mysql 180 Oct 17 09:28 mysql-bin.index [root@bak logs]# chown -R mysql:mysql ./ [root@bak logs]# ll total 1092 -rw-rw---- 1 mysql mysql 107 Oct 17 09:25 mysql-bin.000001 -rw-rw---- 1 mysql mysql 107 Oct 17 09:26 mysql-bin.000002 -rw-rw---- 1 mysql mysql 27681 Oct 17 09:28 mysql-bin.000003 -rw-rw---- 1 mysql mysql 1070549 Oct 17 09:28 mysql-bin.000004 -rw-rw---- 1 mysql mysql 180 Oct 17 09:28 mysql-bin.index
原来是root root权限,改为mysql mysql了,再次启动MySQL进程
[root@bak logs]# ps -ef|grep mysql root 3060 2591 0 09:35 pts/0 00:00:00 grep mysql [root@bak logs]# mysqld_safe & [1] 3061 [root@bak logs]# Starting mysqld daemon with databases from /data/mysql/mysql_3306/data
[root@bak logs]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.39-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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.
(testing)root@localhost [(none)]> exit
[root@bak logs]# ps aux | grep -v grep | grep mysql
root 3061 0.0 0.1 4484 1152 pts/0 S 09:35 0:00 /bin/sh /usr/bin/mysqld_safe mysql 3095 0.0 3.1 330320 32216 pts/0 Sl 09:35 0:02 /usr/libexec/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql/mysql_3306/data --user=mysql --pid-file=/data/mysql/mysql_3306/data/bak.pid --skip-external-locking --port=3306 --socket=/tmp/mysql.sock
这次,数据库顺利启动了,从mysql进程中可以看到,mysqld_safe实际去调用的还是mysqld

总结:
当我们遭遇数据库无法启动,如:自动终止进程stopping from pid file或是无法通过socket连接到服务器等错误,首先要去查看数据库的error.log日志,其中有详细的提示(各种ERROR和WARNING),来给你提供无法启动的线索,我们要做的就是更具这些线索,来做相应的处理,才能更快、更好地解决问题。

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
Composite Index와 여러 단일 열 인덱스를 언제 사용해야합니까?Composite Index와 여러 단일 열 인덱스를 언제 사용해야합니까?Apr 11, 2025 am 12:06 AM

데이터베이스 최적화에서 쿼리 요구 사항에 따라 인덱싱 전략을 선택해야합니다. 1. 쿼리에 여러 열이 포함되고 조건 순서가 수정되면 복합 인덱스를 사용하십시오. 2. 쿼리에 여러 열이 포함되어 있지만 조건 순서가 고정되지 않은 경우 여러 단일 열 인덱스를 사용하십시오. 복합 인덱스는 다중 열 쿼리를 최적화하는 데 적합한 반면 단일 열 인덱스는 단일 열 쿼리에 적합합니다.

MySQL에서 느린 쿼리를 식별하고 최적화하는 방법은 무엇입니까? (느린 쿼리 로그, Performance_schema)MySQL에서 느린 쿼리를 식별하고 최적화하는 방법은 무엇입니까? (느린 쿼리 로그, Performance_schema)Apr 10, 2025 am 09:36 AM

MySQL 느린 쿼리를 최적화하려면 SlowQueryLog 및 Performance_Schema를 사용해야합니다. 1. SlowQueryLog 및 Set Stresholds를 사용하여 느린 쿼리를 기록합니다. 2. Performance_schema를 사용하여 쿼리 실행 세부 정보를 분석하고 성능 병목 현상을 찾고 최적화하십시오.

MySQL 및 SQL : 개발자를위한 필수 기술MySQL 및 SQL : 개발자를위한 필수 기술Apr 10, 2025 am 09:30 AM

MySQL 및 SQL은 개발자에게 필수적인 기술입니다. 1.MySQL은 오픈 소스 관계형 데이터베이스 관리 시스템이며 SQL은 데이터베이스를 관리하고 작동하는 데 사용되는 표준 언어입니다. 2.MYSQL은 효율적인 데이터 저장 및 검색 기능을 통해 여러 스토리지 엔진을 지원하며 SQL은 간단한 문을 통해 복잡한 데이터 작업을 완료합니다. 3. 사용의 예에는 기본 쿼리 및 조건 별 필터링 및 정렬과 같은 고급 쿼리가 포함됩니다. 4. 일반적인 오류에는 구문 오류 및 성능 문제가 포함되며 SQL 문을 확인하고 설명 명령을 사용하여 최적화 할 수 있습니다. 5. 성능 최적화 기술에는 인덱스 사용, 전체 테이블 스캔 피하기, 조인 작업 최적화 및 코드 가독성 향상이 포함됩니다.

MySQL 비동기 마스터 슬레이브 복제 프로세스를 설명하십시오.MySQL 비동기 마스터 슬레이브 복제 프로세스를 설명하십시오.Apr 10, 2025 am 09:30 AM

MySQL 비동기 마스터 슬레이브 복제는 Binlog를 통한 데이터 동기화를 가능하게하여 읽기 성능 및 고 가용성을 향상시킵니다. 1) 마스터 서버 레코드는 Binlog로 변경됩니다. 2) 슬레이브 서버는 I/O 스레드를 통해 Binlog를 읽습니다. 3) 서버 SQL 스레드는 데이터를 동기화하기 위해 Binlog를 적용합니다.

MySQL : 쉽게 학습하기위한 간단한 개념MySQL : 쉽게 학습하기위한 간단한 개념Apr 10, 2025 am 09:29 AM

MySQL은 오픈 소스 관계형 데이터베이스 관리 시스템입니다. 1) 데이터베이스 및 테이블 작성 : CreateAbase 및 CreateTable 명령을 사용하십시오. 2) 기본 작업 : 삽입, 업데이트, 삭제 및 선택. 3) 고급 운영 : 가입, 하위 쿼리 및 거래 처리. 4) 디버깅 기술 : 확인, 데이터 유형 및 권한을 확인하십시오. 5) 최적화 제안 : 인덱스 사용, 선택을 피하고 거래를 사용하십시오.

MySQL : 데이터베이스에 대한 사용자 친화적 인 소개MySQL : 데이터베이스에 대한 사용자 친화적 인 소개Apr 10, 2025 am 09:27 AM

MySQL의 설치 및 기본 작업에는 다음이 포함됩니다. 1. MySQL 다운로드 및 설치, 루트 사용자 비밀번호를 설정하십시오. 2. SQL 명령을 사용하여 CreateAbase 및 CreateTable과 같은 데이터베이스 및 테이블을 만듭니다. 3. CRUD 작업을 실행하고 삽입, 선택, 업데이트, 명령을 삭제합니다. 4. 성능을 최적화하고 복잡한 논리를 구현하기 위해 인덱스 및 저장 절차를 생성합니다. 이 단계를 사용하면 MySQL 데이터베이스를 처음부터 구축하고 관리 할 수 ​​있습니다.

InnoDB 버퍼 풀은 어떻게 작동하며 성능에 중요한 이유는 무엇입니까?InnoDB 버퍼 풀은 어떻게 작동하며 성능에 중요한 이유는 무엇입니까?Apr 09, 2025 am 12:12 AM

innodbbufferpool은 데이터와 색인 페이지를 메모리에로드하여 MySQL 데이터베이스의 성능을 향상시킵니다. 1) 데이터 페이지가 버퍼 풀에로드되어 디스크 I/O를 줄입니다. 2) 더러운 페이지는 정기적으로 디스크로 표시되고 새로 고침됩니다. 3) LRU 알고리즘 관리 데이터 페이지 제거. 4) 읽기 메커니즘은 가능한 데이터 페이지를 미리로드합니다.

MySQL : 초보자를위한 데이터 관리의 용이성MySQL : 초보자를위한 데이터 관리의 용이성Apr 09, 2025 am 12:07 AM

MySQL은 설치가 간단하고 강력하며 데이터를 쉽게 관리하기 쉽기 때문에 초보자에게 적합합니다. 1. 다양한 운영 체제에 적합한 간단한 설치 및 구성. 2. 데이터베이스 및 테이블 작성, 삽입, 쿼리, 업데이트 및 삭제와 같은 기본 작업을 지원합니다. 3. 조인 작업 및 하위 쿼리와 같은 고급 기능을 제공합니다. 4. 인덱싱, 쿼리 최적화 및 테이블 파티셔닝을 통해 성능을 향상시킬 수 있습니다. 5. 데이터 보안 및 일관성을 보장하기위한 지원 백업, 복구 및 보안 조치.

See all articles

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

DVWA

DVWA

DVWA(Damn Vulnerable Web App)는 매우 취약한 PHP/MySQL 웹 애플리케이션입니다. 주요 목표는 보안 전문가가 법적 환경에서 자신의 기술과 도구를 테스트하고, 웹 개발자가 웹 응용 프로그램 보안 프로세스를 더 잘 이해할 수 있도록 돕고, 교사/학생이 교실 환경 웹 응용 프로그램에서 가르치고 배울 수 있도록 돕는 것입니다. 보안. DVWA의 목표는 다양한 난이도의 간단하고 간단한 인터페이스를 통해 가장 일반적인 웹 취약점 중 일부를 연습하는 것입니다. 이 소프트웨어는

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

에디트플러스 중국어 크랙 버전

에디트플러스 중국어 크랙 버전

작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

Dreamweaver Mac版

Dreamweaver Mac版

시각적 웹 개발 도구

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경