Grasp.Today

关于mysql启动问题---mysqld_safe mysqld from pid file * ended

#在[mysqld]中添加:

datadir = /usr/local/mysql/data         #添加

log-error = /usr/local/mysql/data/error.log  #添加

#pid-file = /usr/local/mysql/data/mysql.pid   #注释掉

tmpdir = /var/tmp #不建议放在/tmp下

我先说一下我安装mysql的操作吧:

1、开始的时候,安装mysql,是那种解压缩就能用的软件包。我把它解压后,拷贝到/usr/local/ 目录下,并把名字命名为mysql。

2、建立用户mysql。[root@localhost ~]# useradd mysql

3、修改权限。[root@localhost ~]# chown -R mysql:mysql /usr/local/mysql

4、初始化mysql。进入/usr/local/mysql目录下的/usr/local/mysql/scripts/目录,有个mysql_install_db可执行文件。运行/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data &(这点非常重要)

不运行红色字体的,可能会出现错误:

FATAL ERROR: Could not find ./bin/my_print_defaults
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

5、启动mysql服务。运行[root@localhost ~]# /usr/local/mysql/bin/mysqld_safe

120223 21:42:59 mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'. 
chown: “/usr/local/mysql/data/localhost.localdomain.err” 后缺少操作数 
请尝试执行“chown --help”来获取更多信息。 
120223 21:42:59 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

出现类似的提示说明启动成功

主意:可能会出现这个错误

mysqldump: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory

解决方案就是:

1、先查找libmysqlclient.so.16文件存在否。

[root@localhost ~]# find \ –name libmysqlclient.so.16

2、若存在。建立软连接。

ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/ 主意:若系统是64bit的,则是:

ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib64/

 

其实说了这么多还没有说到我需要说的问题。

不知怎么的,我安装的mysql在/etc/下没有my.cnf文件。

由于测试需要,故拷贝了一个my.cnf文件。然后再启动,报这个问题。

[root@localhost ~]# /usr/local/mysql/bin/mysqld_safe 
120223 21:29:59 mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'. 
chown: “/usr/local/mysql/data/localhost.localdomain.err” 后缺少操作数 
请尝试执行“chown --help”来获取更多信息。 
120223 21:29:59 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data 
120223 21:29:59 mysqld_safe mysqld from pid file /usr/local/mysql/data/localhost.localdomain.pid ended

 

 

 

----------------------------------

posted @ 2017-07-26 18:00  gaohj  阅读(12958)  评论(0编辑  收藏  举报