CentOS7.4编译安装MySQL5.7.21的详细教程
一、卸载mariadb
centos7默认安装了和mysql有兼容性的mariadb,在我们安装mysql5.7之前为了避免发生冲突首先删除mariadb。
# rpm -qa | grep maria
yum remove mariadb-libs -y
二、安装环境
yum -y install make cmake bison-devel ncurses-devel gcc gcc-c++ kernel-devel &&\
yum install -y readline-devel pcre-devel openssl-devel openssl zlib zlib-devel pcre-devel perl perl-devel wget
三、下载boost,一定要是1_59_0
wget -c https://dl.bintray.com/boostorg/release/1.59.0/source/boost_1_59_0.tar.gz
tar -xzvf boost_1_59_0.tar.gz
cp boost_1_59_0 /usr/local/
四、安装mysql
wget -c https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.22.tar.gz &&\
tar -zxvf mysql-5.7.22.tar.gz && rm -f mysql-5.7.22.tar.gz && cd mysql-5.7.22
cmake . -dcmake_install_prefix=/usr/local/mysql -dmysql_datadir=/var/lib/mysql -dsysconfdir=/etc -dwith_innobase_storage_engine=1 -dwith_archive_storage_engine=1 -dwith_blackhole_storage_engine=1 -dwith_federated_storage_engine=1 -dwith_partition_storage_engine=1 -dmysql_unix_addr=/tmp/mysqld.sock -denabled_local_infile=1 -dwith_extra_charsets=all -dmysql_user=mysql -ddownload_boost=1 -dwith_boost=/usr/local/boost_1_59_0
gmake && make install
五、安装之后的一些配置:
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
mkdir /var/lib/mysql
chown mysql. mysql
vi /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /var/lib/mysql
port = 3306
socket = /tmp/mysqld.sock
mysql_install_db 被废弃了,取而代之的是 mysqld –initialize
# /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize --datadir=/var/lib/mysql --basedir=/usr/local/mysql --user=mysql
# systemctl start mysql
# ps -ef|grep mysql
# vi ~/.bash_profile
path=$path:$home/bin:/usr/local/mysql/bin
ln -s /usr/local/mysql/bin/mysql /usr/bin
# mysql
error 1045 (28000): access denied for user 'root'@'localhost' (using password: no)
配置文件中添加如下一行,跳过密码验证
# cat /etc/my.cnf
[mysqld]
skip-grant_tables
重启mysql
# systemctl restart mysql
# mysql
mysql> update mysql.user set authentication_string=password('oracle') where user='root' ;
再次重启mysql
# systemctl restart mysql
# mysql
mysql> show databases;
推荐阅读
-
Windows(x86,64bit)升级MySQL 5.7.17免安装版的详细教程
-
apk反编译工具Apktool的安装与使用教程
-
如何运行openSUSE?Win10中安装SUSE Linux子系统的详细图文教程
-
JDK1.6的下载、安装与配置图文详细教程 推荐
-
打印机的安装方法 添加本地或网络打印机的详细方法(图文教程)
-
U盘安装windows8的详细步骤(图文教程)
-
电信10000管家的安装和卸载图文教程以及10000管家功能详细介绍
-
jq获取input的输入值(java安装教程详细)
-
在Centos7中安装Docker1.12的详细教程
-
在一台电脑安装Win8和Win7双系统的安装的详细方法(图文教程)