mysql 安装

首先安装一些必要的包

yum -y install  gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*

mysql-5.6编译的时候用的是cmake 所以还要安装cmake

我用的是源码

直接 ./configure make make install 就行


接下来安装  mysql


useradd mysql


tar zxvf mysql-5.6.12.tar.gz


cd mysql-5.6.12


cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data


make

make install


chmod +w /usr/local/mysql


chown -R mysql:mysql /usr/local/mysql


chmod -R 755 /usr/local/mysql/data


cd /usr/local/mysql


chown -R mysql:mysql data


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


cd support-files/


cp my-large.cnf /etc/my.cnf


vi /etc/my.cnf


basedir = /usr/local/mysql

datadir = /usr/local/mysql/data

port = 3306

# server_id = .....

socket = /tmp/mysql.sock

log-error=/var/log/mysql_error.log

cp mysql.server /etc/init.d/mysqld


chmod +x /etc/init.d/mysqld


/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/loacl/mysql/data --user=mysql


vi /etc/profile


export PATH=$PATH:/usr/local/mysql/bin


source /etc/profile


service mysqld start


你可能感兴趣的:(mysql,local)