mysql5.7.26编译安装1

1,环境准备

    centos 7.4 关闭防火墙,配置好dns

   建立用户useradd test

2,安装包准备

3,上传到服务器,解压安装包

cd /home/test

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.26.tar.gz

tar zxvf mysql-5.7.26.tar.gz

cd mysql-5.7.26

tar zxvf boost_1_59_0.tar.gz

3,安装依赖

yum -y install gcc gcc-c++ ncurses ncurses-devel bison libgcrypt perl make cmake

4,开始编译,注意经常有人回出现拷贝编译参数而编译不过去的情况,多数未字符集不是utf-8

mkdir /home/test/mysql 

cmake . \
-DCMAKE_INSTALL_PREFIX=/home/test/mysql \
-DINSTALL_DATADIR=/home/test/mysql/dbdata \
-DSYSCONFDIR=/home/test/mysql/etc \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_SSL=system \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_BOOST=/home/test/mysql/boost_1_59_0 \
-DMYSQL_UNIX_ADDR=/home/test/mysql/mysql.sock

 

 

make 

make install

4,初始化数据库

/home/test/mysql/bin/mysqld --defaults-file=/home/test/mysql/etc/my.cnf --basedir=/home/test/mysql --datadir=/home/test/mysql/dbdata/data --initialize-insecure 

chown -R test. /home/test

5,启动mysql

su - test

/home/test/mysql/bin/mysqld_safe --defaults-file=/home/test/mysql/etc/my.cnf --user=test &

6,刷新页面登录mysql设置密码首次登录五密码,设置密码mysql!333

mysql

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Mysql!333';
GRANT ALL PRIVILEGES ON *.* TO 'test'@'%' IDENTIFIED BY 'mysql333';
 
111
posted @ 2021-03-01 15:46  苦读二十年  阅读(155)  评论(0编辑  收藏  举报