ITPub博客

首页 > Linux操作系统 > Linux操作系统 > can't create PID file问题处理

can't create PID file问题处理

原创 Linux操作系统 作者:lirenquan 时间:2011-03-13 23:40:13 0 删除 编辑

今天在启动MYSQL数据库时,报如下错误:
[root@ora10g mysql]# ./bin/mysqld_safe --user=mysql &
[1] 4005
[root@ora10g mysql]# 101209 16:37:19 mysqld_safe Logging to '/var/log/mysqld.log'.

[root@ora10g mysql]# 101209 16:37:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

[root@ora10g mysql]#
[root@ora10g mysql]#
[root@ora10g mysql]# 101209 16:37:25 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

[1]+  Done                    ./bin/mysqld_safe --user=mysql
[root@ora10g mysql]#
[root@ora10g mysql]#
[root@ora10g mysql]# more /var/run/mysqld/mysqld.pid
/var/run/mysqld/mysqld.pid: No such file or directory
[root@ora10g mysql]# more /var/log/mysqld.log
101209 16:37:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
101209 16:37:20 InnoDB: The InnoDB memory heap is disabled
101209 16:37:20 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
101209 16:37:20 InnoDB: Compressed tables use zlib 1.2.3
101209 16:37:20 InnoDB: Initializing buffer pool, size = 128.0M
101209 16:37:20 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
101209 16:37:21  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
101209 16:37:22  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
101209 16:37:22  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
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
101209 16:37:24  InnoDB: Waiting for the background threads to start
101209 16:37:25 InnoDB: 1.1.5 started; log sequence number 0
101209 16:37:25 [ERROR] /usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2)
101209 16:37:25 [ERROR] Can't start server: can't create PID file: No such file or directory
101209 16:37:25 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

从表面上来看,这应该是访问权限不够,确认:
1、到/var/run目录下查看:
[root@ora10g mysql]# cd /var/run
[root@ora10g run]# ls -l mysqld*
ls: mysqld*: No such file or directory
2、创建该目录,并将其权限赋给mysql用户
[root@ora10g run]# mkdir mysqld
[root@ora10g run]# cd mysqld
[root@ora10g mysqld]# ls -l
total 0
[root@ora10g mysqld]# cd ..
[root@ora10g run]# chown -R mysql:mysql /var/run/mysqld
[root@ora10g run]#
3、启动mysql数据库进程
[root@ora10g run]# cd /usr/local/mysql
[root@ora10g mysql]# bin/mysqld_safe --user=mysql &
[1] 4350
[root@ora10g mysql]# 101209 16:46:00 mysqld_safe Logging to '/var/log/mysqld.log'.
101209 16:46:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
4、确认
[root@ora10g mysql]# tail -10f /var/log/mysqld.log
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1595675
101209 16:46:00  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 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
101209 16:46:00 InnoDB: 1.1.5 started; log sequence number 1595675
101209 16:46:00 [Note] Event Scheduler: Loaded 0 events
101209 16:46:00 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.5.9'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution

[root@ora10g mysql]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.9 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> \q
Bye

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12350275/viewspace-689321/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-12-24

  • 博文量
    24
  • 访问量
    109051