如何从CentOS源代码编译和安装MySQL 5.7.29呢,下面做个简单明了的过程记录,希望对大家有用。 安装编译工具和必要的包: yum install gcc gcc-c++ ncurses-devel cmake bison 下载mysql源代码 wget htt
如何从CentOS源代码编译和安装MySQL 5.7.29呢,下面做个简单明了的过程记录,希望对大家有用。
安装编译工具和必要的包:
yum install gcc gcc-c++ ncurses-devel cmake bison
下载mysql源代码
wget https://github.com/mysql/mysql-server/archive/mysql-5.7.29.tar.gz
编译并安装MySQL
/usr/sbin/groupadd mysql/usr/sbin/useradd -g mysql mysqlcd /tmptar xvf mysql-5.7.29.tar.gzcd mysql-5.7.29/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/var/mysql/data -DMYSQL_USER=mysql
开始编译安装
makemake install
配置MySQL
mysql_secure_installation
设置MySQL
chmod +w /usr/local/mysqlchown -R mysql:mysql /usr/local/mysqlln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16mkdir -p /var/mysql/mkdir -p /var/mysql/data/mkdir -p /var/mysql/log/chown -R mysql:mysql /var/mysql/cd support-files/cp my-large.cnf /var/mysql/my.cnfcp mysql.server /etc/rc.d/init.d/mysqld
/usr/local/mysql/scripts/mysql_install_db –defaults-file=/var/mysql/my.cnf –basedir=/usr/local/mysql –datadir=/var/mysql/data –user=mysql
chmod +x /etc/init.d/mysqld
vi /etc/init.d/mysqldbasedir=/usr/local/mysqldatadir=/var/mysql/data
在系统启动时运行mysql:
chkconfig –add mysqldchkconfig –level 345 mysqld on
启动服务:
service mysqld start