can't create PID file问题处理

今天在启动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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/12350275/viewspace-689321/

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Unix编程常见问题解答(FAQ/Frequently Asked Questions)(v1.37)(中文版 v0.1.0) 作者:天下一菜 来源:博客园 问题目录 ******** (译者:这里我有意保留原文以便于查询) 1. Process Control 进程控制 1.1 Creating new processes: fork() 创建新进程:fork函数 1.1.1 What does fork() do? fork函数干什么? 1.1.2 What's the difference between fork() and vfork()? fork函数 与 vfork函数的区别在哪里? 1.1.3 Why use _exit rather than exit in the child branch of a fork? 为何在一个fork的子进程分支中使用_exit函数而不使用 exit函数? 1.2 Environment variables 环境变量 1.2.1 How can I get/set an environment variable from a program? 我怎样在程序中获得/设置环境变量? 1.2.2 How can I read the whole environment? 我怎样读取整个环境变量表? 1.3 How can I sleep for less than a second? 我怎样睡眠小于一秒? http://archive.cnblogs.com/a/201848/(第 2/66 页)2011-12-20 9:55:10 Unix编程常见问题解答(FAQ / Frequently Asked Questions)(v1.37)(中文版 v0.1.0) - 博客文库 - 博客园 1.4 How can I get a finer-grained version of alarm()? 我怎样得到一个更细分时间单位的alarm函数版本(译者注:希望alarm 的时间小于一秒)? 1.5 How can a parent and child process communicate? 父子进程如何通信? 1.6 How do I get rid of zombie processes? 我怎样去除僵死进程? 1.6.1 What is a zombie? 何为僵死进程? 1.6.2 How do I prevent them from occuring? 我怎样避免它们的出现? 1.7 How do I get my program to act like a daemon? 我怎样使我的程序作为守护程序运行? 1.8 How can I look at process in the system like ps does? 我怎样象ps程序一样审视系统的进程? 1.9 Given a pid, how can I tell if it's a running program? 给定一个进程号(译者注:pid: process ID),我怎样知道它是个正 在运行的程序? 1.10 What's the return value of system/pclose/waitpid? system函数,pclose函数,waitpid函数 的返回值是什么? 1.11 How do I find out about a process' memory usage? 我怎样找出一个进程的存储器使用情况? 1.12 Why do processes never decrease in size? 为什么进程的大小不缩减? 1.13 How do I change the name of my program (as seen by `ps')? 我怎样改变我程序的名字(即“ps”看到的名字)? 1.14 How can I find a process' executable file? 我怎样找到进程的相应可执行文件? 1.14.1 So where do I put my configuration files then? 那么,我把配置文件放在哪里呢? 1.15 Why doesn't my process get SIGHUP when its parent dies? 为何父进程死时,我的进程未得到SIGHUP信号? 1.16 How can I kill all descendents of a process? 我怎样杀死一个进程的所有派生进程? 2. General File handling (including pipes and sockets) 一般文件操作(包括管道和套接字) 2.1 How to manage multiple connections? 怎样管理多个连接? 2.1.1 How do I use select()? 我怎样使用select()? 2.1.2 How do I use poll()? 我怎样使用poll() ? 2.1.3 Can I use SysV IPC at the same time as select or poll? 我是否可以将SysV 进程间通信 (译者注:IPC: Interprocess Communications) 与select或poll同 时使用? 2.2 How can I tell when the other end of a connection shuts down? 我怎么知道连接的另一端已关闭? 2.3 Best way to read directories? 读目录的最好方法? 2.4 How can I find out if someone else has a file open? 我怎么知道其他人已经打开一个文件? 2.5 How do I `lock' a file? 我怎样锁定一个文件? 2.6 How do I find out if a file has been updated by another process? 我怎么知道一个文件是否已被其他进程更新? 2.7 How does the `du' utility work? “du”工具程序是怎么工作的? 2.8 How do I find the size of a file? 我怎么知道一个文件的大小? 2.9 How do I expand `~' in a filename like the shell does? 我怎样象shell程序一样将一个文件名中含有的“~”展开? 2.10 What can I do with named pipes (FIFOs)? 我能用有名管道(FIFOs)(译者注:FIFO: First In First Oout)干什么? 2.10.1 What is a named pipe? 什么是有名管道? 2.10.2 How do I create a named pipe? 我怎样创建一个有名管道? 2.10.3 How do I use a named pipe? 我怎样使用一个有名管道? 2.10.4 Can I use a named pipe across NFS? 我能基于网络文件系统(译者注:NFS:Network File System)使用有名管道 吗? 2.10.5 Can multiple processes write to the pipe simultaneously? 多个进程能否同时向这个管道写执行写操作? 2.10.6 Using named pipes in applications 在应用程序中使用有名管道。 3. Terminal I/O 终端输入/输出(I/O:input/output) 3.1 How can I make my program not echo input? 我怎样使我的程序不回射输入? 3.2 How can I read single characters from the terminal? 我怎样从终端读取单个字符? 3.3 How can I check and see if a key was pressed? 我怎样检查是否一个键被摁下? 3.4 How can I move the cursor around the screen? 我怎样将光标在屏幕里移动? http://archive.cnblogs.com/a/201848/(第 3/66 页)2011-12-20 9:55:10 Unix编程常见问题解答(FAQ / Frequently Asked Questions)(v1.37)(中文版 v0.1.0) - 博客文库 - 博客园 3.5 What are pttys? pttys(pttys:Pseudo-teletypes)是什么? 3.6 How to handle a serial port or modem? 怎样控制一个串行口和调制解调器(译者注:modem: modulate-demodulate) 3.6.1 Serial device names and types 串行设备和类型 3.6.2 Setting up termios flags 设置termios的标志位 3.6.2.1 c_iflag 3.6.2.2 c_oflag 3.6.2.3 c_cflag 3.6.2.4 c_lflag 3.6.2.5 c_cc 4. System Information 系统信息 4.1 How can I tell how much memory my system has? 我怎样知道我的系统有多少存储器容量? 4.2 How do I check a user's password? 我怎样检查一个用户的口令? 4.2.1 How do I get a user's password? 我怎样得到一个用户的口令? 4.2.2 How do I get shadow passwords by uid? 我怎样通过用户号(译者注:uid: User ID)得到阴影口令文件中的口令? 4.2.3 How do I verify a user's password? 我怎样核对一个用户的口令? 5. Miscellaneous programming 编程杂技 5.1 How do I compare strings using wildcards? 我怎样使用通配字符比较字符串? 5.1.1 How do I compare strings using filename patterns? 我怎样使用文件名通配模式比较字符串? 5.1.2 How do I compare strings using regular expressions? 我怎样使用正则表达式比较字符串? 5.2 What's the best way to send mail from a program? 什么是在程序中发送电子邮件的最好方法? 5.2.1 The simple method: /bin/mail 简单方法:/bin/mail 5.2.2 Invoking the MTA directly: /usr/lib/sendmail 直接启动邮件传输代理(译者注:MTA: mail transfer agent):/usr/ bin/sendmail 5.2.2.1 Supplying the envelope explicitly 显式提供收件人信息 5.2.2.2 Allowing sendmail to deduce the recipients 允许sendmail程序根据邮件内容分析出收件人 6. Use of tools 工具的使用 6.1 How can I debug the children after a fork? 我怎样调试fork函数产生的子进程? 6.2 How to build library from other libraries? 怎样通过其他库文件建立新的库文件? 6.3 How to create shared libraries / dlls? 怎样创建动态连接库/dlls? 6.4 Can I replace objects in a shared library? 我能更改一个动态连接库里的目标吗? 6.5 How can I generate a stack dump from within a running program? 我能在一个运行着的程序中生成堆栈映象吗?

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值