Ubuntu Server 16.04服务器版配置图解教程13 - 安装Mysql(源码包安装)

时间:2024-02-16 21:45:05

mysql官网安装文档:https://dev.mysql.com/doc/refman/8.0/en/installing-source-distribution.html

mysql官网下载地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloads

1、添加用户及用户组

# Preconfiguration setup
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
# Beginning of source-build specific instructions
shell> tar zxvf mysql-boost-5.7.22.tar.gz
shell> cd mysql-5.7.22
shell> mkdir bld
shell> cd bld
shell> cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDOWNLOAD_BOOST=0 -DWITH_BOOST=../boost/boost_1_59_0/ -DSYSCONFDIR=/etc/my.cnf
shell> make
shell> make install

# End of source-build specific instructions

# Postinstallation setup
shell> cd /usr/local/mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql
shell> bin/mysql_ssl_rsa_setup
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server