最新消息: 新版网站上线了!!!

linux lamp之离线安装mysql

Linux下自己创建目录/tigger

上传mysql压缩包到此目录

[root@localhost tigger]# tar zxvf mysql.tar.gz

[root@localhost tigger]# cp -r mysql /usr/local/mysql


/usr/local/mysql 为安装目录

cd /usr/local/mysql


[root@localhost mysql]# groupadd mysql

[root@localhost mysql]# useradd -g mysql mysql

[root@localhost mysql]# chown -R mysql .

[root@localhost mysql]# chown -R root .


[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data


拷贝mysql.server文件到/etc/rc.d/init.d/并且命名为mysqld。mysql.server这个文件相当重要,是mysql的设置,可以多看看

[root@localhost mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld

设置权限为755,不然启动mysql会失败的

[root@localhost mysql]# chmod 755 /etc/rc.d/init.d/mysqld


启动mysql:

[root@localhost bin]# service mysqld start

结果失败:

[root@localhost bin]# service mysqld start

Starting MySQL............................................ ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid)

解决办法:

1、/usr/local/mysql/data/ 查看并设置此目录权限 

2、chmod 755 /etc/rc.d/init.d/mysqld 查看并设置此文件权限


localhost.localdomain.pid 记录进程的进程号,在mysql的配置文件里可以配这个文件的名称


.....

转载请注明:谷谷点程序 » linux lamp之离线安装mysql