搜档网
当前位置:搜档网 › 编译安装mysql

编译安装mysql

编译安装mysql
编译安装mysql

1.安装相关库文件

yum install bison gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libtool-ltdl-devel*

库文件在名为gcc的文件夹中。

2.安装cmake

tar zxvf cmake-2.8.6.tar.gz

cd cmake-2.8.6/

./configure

gmake

gmake install

3.设置用户

/usr/sbin/groupadd mysql (如果有提示已存在,并不是错误)

/usr/sbin/useradd -g mysql mysql (如果有提示已存在,并不是错误)

mkdir -p /data/mysql

chown -R mysql:mysql /data/mysql

4.解压并安装mysql

tar zxvf mysql-5.5.17.tar.gz

cd mysql-5.5.17

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc/

make

make install

5.设置

cd /usr/local/mysql

cp ./support-files/https://www.sodocs.net/doc/4512865856.html,f /etc/https://www.sodocs.net/doc/4512865856.html,f

编辑/etc/https://www.sodocs.net/doc/4512865856.html,f

vi /etc/https://www.sodocs.net/doc/4512865856.html,f

在[mysqld] 段增加

datadir = /data/mysql

wait-timeout = 30

max_connections = 512

max_connect_errors = 10000000

default-storage-engine = MyISAM

在[mysqld] 段修改

max_allowed_packet = 16M

./scripts/mysql_install_db --user=mysql

cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld chmod 755 /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

chkconfig --level 3 mysqld on

编译/etc/rc.d/init.d/mysqld

vi /etc/rc.d/init.d/mysqld

把basedir=编辑成basedir=/usr/local/mysql

把datadir=编辑成datadir=/data/mysql

service mysqld start

bin/mysqladmin -u root password 'password_for_root'

其中引号内的password_for_root是要设置的root密码service mysqld restart

进入Mysql

bin/mysql -uroot -p

相关主题