源码安装Mysql5.7

Linux Mysql务器安装
关系型数据库:MySQL、MaraiDB、Oracle、SQL Server、PostgreSQL、DB2
MySQL引擎包括:ISAM、MyISAM、InnoDB、Memory、CSV、BlackHole、Archive、Performance_Schema、Berkeley、Federated、Cluster/NDB
源码安装Mysql5.7
Mysql服务器安装YUM/rpm mysql5.7.16-10
yum install mysql-server mysql-devel mysql-libs -y CentOS 6.X版本
源码安装Mysql5.7
yum install mariadb-server mariadb mariadb-libs -y CentOS 7.X版本
Mysql服务器安装源码
http://down1.chinaunix.net/distfiles/mysql-5.5.20.tar.gz
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
yum install cmake ncurses - devel ncurses -y
yum install -y cmake make gcc gcc-c++ libaio ncurses ncurses-devel
源码安装Mysql5.7
解压安装包
tar -zxvf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
将解压的复制到 /usr/local/mysql 目录
cp -r mysql-5.7.25-linux-glibc2.12-x86_64 /usr/local/mysql
添加mysql组和mysql用户
groupadd mysql
useradd -r -g mysql mysql
源码安装Mysql5.7
安装数据库
cd /usr/local/mysql/ 切换至软件包目录
chown -R mysql:mysql ./ 修改当前目录拥有者为mysql
mkdir data
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
源码安装Mysql5.7
数据库初始密码为:G!jPM#Kh,4pq
创建RSA private key
bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysql/data
源码安装Mysql5.7
chown -R mysql:mysql ./ 修改当前目录拥有者为mysql
chown -R mysql:mysql data 修改data目录拥有者为mysql
修改数据库字符集
vim /etc/my.cnf
character-set-server=utf8 行首加入
init_connect=‘SET NAMES utf8
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
#不区分大小写
lower_case_table_names = 1
#不开启sql严格模式
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
log-error=/var/log/mysqld.log
pid-file=/usr/local/mysql/data/mysqld.pid
添加开机启动
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
修改启动文件
vim /etc/init.d/mysqld
源码安装Mysql5.7
cd /var/lib/mysql/ ;mkdir mysql
加入开机启动
chkconfig --add mysqld
添加软链接
ln -s /usr/local/mysql/bin/mysql /usr/bin
启动mysql

相关推荐