时间:2021-07-01 10:21:17 帮助过:2人阅读
2.获取mysql源代码:
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz
3.编译安装mysql:
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysqldb \
-DMYSQL_TCP_PORT=3306 \
-DENABLE_DOWNLOADS=1
make ---make install
4.修改mysql目录所有者和组
cd /usr/local/mysql
chown -R mysql:mysql
cd /data/mysqldb
chown -R mysql:mysql
5.初始化mysql数据库:
cd /usr/local/mysql
scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb
6. 复制mysql的配置文件
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
7.复制服务器启动脚本
cp support-files/mysql.server /etc/init.d/mysqld
Linux下编译安装mysql
标签: