标签:mysql源码安装
卸载已经安装过的旧版本mysql
rpm -e mysql rpm -e --nodeps mysql yum remove mysql
安装MySql
安装mysql依赖包
yum -y install make gcc-c++ cmake bison-devel ncurses-devel
下载mysql5.6.33
网址http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/
wget http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/mysql-5.6.33.tar.gz tar -zxvf mysql-5.6.33.tar.gz cd mysql-5.6.33
编译安装
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysqldb -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci make && make install
配置mysql
chown -R mysql:mysql /usr/local/mysql mkdir -p /data/mysqldb chown -R mysql:mysql /data mv /etc/my.cnf /etc/my.bak
初始化mysql
cd /usr/local/mysql scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysqldb --user=mysql
启动mysql
cp support-files/mysql.server /etc/init.d/mysqld chkconfig mysql on service mysql start
mysql环境变量配置
PATH=/usr/local/mysql/bin:$PATH export PATH source /etc/profile
设置root登录口令
mysql -uroot mysql> SET PASSWORD = PASSWORD(‘123456‘);
标签:mysql源码安装
原文地址:http://linuxinfo.blog.51cto.com/412748/1866426