编译前安装准备
创新互联主营黄龙网站建设的网络公司,主营网站建设方案,app软件开发公司,黄龙h5成都小程序开发搭建,黄龙网站营销推广欢迎黄龙等地区企业咨询
OS:CentOS 6.9
MySQL:5.7.18
下载Mysql源
官网源:mysql-boost mysql
搜狐源:mysql-boost mysql
安装Mysql之前卸载原有的版本
查询Mysql目录文件 卸载原有MySQL
# rpm -qa | grep mysql
# find / -name mysql
# yum remove -y mysql-libs-5.1.73-3.el6_5.x86_64
安装编译环境
# yum -y install make wget gcc-c++ cmake bison-devel ncurses-devel
Preconfiguration setup
# groupadd mysql
# useradd -r -g mysql -s /bin/false mysql
Beginning of source-build specific instructions
# mkdir ~/mysql && cd ~/mysql
# mkdir -p /data/mysql_data
# wget -c https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.18.tar.gz
# tar -zxvf mysql-boost-5.7.18.tar.gz && cd mysql-5.7.18/
# cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql_data \
-DSYSCONFDIR=/etc \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/boost \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
# make
# make install
End of source-build specific instructions
Postinstallation setup
# cd /usr/local/mysql
# chown -R mysql .
# chgrp -R mysql .
Before MySQL 5.7.6
# bin/mysql_install_db --user=mysql
MySQL 5.7.6 and up
# bin/mysqld --initialize --user=mysql
# bin/mysql_ssl_rsa_setup
# chown -R root .
# chown -R mysql /data
# bin/mysqld_safe --user=mysql &
配置开机启动项
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql.server
# chmod +x /etc/init.d/mysql.server
# chkconfig --add mysql.server
# chkconfig mysql.server on
配置/etc/my.cnf 仅供参考,可以不配用默认的。
启动mysql
# service mysql.server start
加入开机启动项
# chkconfig --live 35 mysql.server on
查看端口是否被占用
# netstat -tulnp | grep 3306
查看数据库版本
# ln -s /usr/local/mysql/bin/mysql /usr/bin/
# mysql --version
登入数据库
# mysql -u root -p
查看数据库
>show databases;
重设密码,这里密码设置为?root?
>set password = password('?root?');
退出数据库
>exit;
分享名称:使用标准源分发安装MySQL
文章位置:http://lswzjz.com/article/jschoc.html