10年工作经验,专研网站运维。
全部博文(454)
分类: LINUX
2012-12-25 10:43:32
启动mysql要制定配置文件:
[root@corshetlpro01 33mysql]# ./bin/mysqld_safe --defaults-file=/33mysql/etc/my.cnf &
[root@ebsdalian ~]# mkdir /44mysql
[root@ebsdalian 44mysql]# mkdir /44mysql/etc
[root@ebsdalian 44mysql]# mkdir /44mysql/tmp
[root@ebsdalian 44mysql]# mkdir /44mysql/var/lib/mysql –p
停止mysql服务器
保存库文件,保存配置文件。
[root@ebsdalian ~]# tar zxvf mysql-5.1.34.tar.gz
[root@ebsdalian ~]# cd mysql-5.1.34
[root@ebsdalian mysql-5.1.34]# ls
[root@ebsdalian mysql-5.1.34]# ./configure --help
[root@ebsdalian mysql-5.1.34]# ./configure --prefix=/44mysql/ --with-unix-socket-path=/44mysql/var/lib/mysql/mysql.sock --sysconfdir=/44mysql/etc --localstatedir=/44mysql/data --with-tcp-port=3308 --with-mysqld-user=mysql
[root@ebsdalian mysql-5.1.34]# make
[root@ebsdalian mysql-5.1.34]# make install
[root@ebsdalian mysql-5.1.34]# cd /55mysql/
[root@ebsdalian 55mysql]# chown -R mysql.mysql /55mysql/
[root@ebsdalian 44mysql]# ./bin/mysql_install_db --basedir=/44mysql/ --datadir=/44mysql/data --user=mysql
[root@ebsdalian 55mysql]# chown -R mysql.mysql /55mysql/
下面给权限,做配置:
[root@ebsdalian 44mysql]# chown -R mysql.mysql /44mysql/
[root@ebsdalian 44mysql]# chmod -R 755 /44mysql/
[root@ebsdalian mysql-5.1.34]# cp /root/mysql-5.1.34/support-files/my-medium.cnf /44mysql/etc/my.cnf
[root@ebsdalian 44mysql]# chmod -R 777 /44mysql/tmp/
[root@ebsdalian 44mysql]# cp /root/mysql-5.1.34/support-files/mysql.server /etc/init.d/mysql4
[root@ebsdalian 44mysql]# chmod +x /etc/init.d/mysql4
[root@ebsdalian 44mysql]# vim /etc/init.d/mysql4
修改如下内容:conf=/etc/my.cnf 改成:
conf=/44mysql/etc/my.cnf
保存退出。
[root@ebsdalian bin]# vim /44mysql/etc/my.cnf
在[mysqld]下面添加如下内容:
[mysqld]
# Add by Liu Yi
datadir =/44mysql/data
log-error =/44mysql/data/error.log
pid-file =/44mysql/data/mysql.pid
tmpdir =/44mysql/tmp
user =mysql
保存退出。
[root@ebsdalian 44mysql]# chmod 777 /44mysql/data/
[root@ebsdalian 44mysql]# vim /etc/init.d/mysql4
basedir=/44mysql
datadir=/44mysql/data
保存退出。
[root@ebsdalian 44mysql]# chmod -R 775 /44mysql/
[root@ebsdalian 44mysql]# cp /44mysql/etc/my.cnf /44mysql/
[root@ebsdalian 44mysql]# chmod -R 777 /44mysql/var/
初次启动mysql:
[root@corshetlpro01 33mysql]# ./bin/mysqld_safe --defaults-file=/33mysql/etc/my.cnf &
以后重启mysql:
[root@corshetlpro01 33mysql]# /etc/init.d/mysql3 restart