首页 小组 文章 搜索 用户
全部 linux Nginx Apache PHP DNS windows 其它 同步与备份 js 数据库 前端 unix

centos8下编译安装mysql5.7boost版无密码无插件版

天边的云
发表于 2020-09-17 19:19:59

centos8下安装mysql5.7boost版,前面的一版初始化时有密码,这一版设置为初始化后无密码,方便设置密码,mysql安装于/usr/local/mysql,数据存放于/home/mysql/data目录。

安装支持组件并创建mysql用户和文件夹

yum -y install wget make cmake gcc-c++ cmake libtirpc-devel ncurses-devel  openssl* bison perl perl-devel perl perl-devel
mkdir -p /usr/local/mysql
mkdir -p /home/mysql/data
groupadd -r mysql
useradd -g mysql -r -M -s /sbin/nologin mysql

安装rpcsvc

wget https://github.com/thkukuk/rpcsvc-proto/releases/download/v1.4.2/rpcsvc-proto-1.4.2.tar.xz
tar -Jxvf rpcsvc-proto-1.4.2.tar.xz
cd rpcsvc-proto-1.4.2
./configure
make&&make install

下载mysql5.7-boost,你也可以去官网下载最新版本:https://dev.mysql.com/downloads/mysql/5.7.html,看版本号将下面的版本改成新的版本号

mysqlver=5.7.31
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-$mysqlver.tar.gz
tar zxvf mysql-boost-$mysqlver.tar.gz
mv mysql-$mysqlver/* /usr/local/mysql
cd /usr/local/mysql

编译安装

cmake -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_BOOST=boost
cpu=`more /proc/cpuinfo |grep "physical id"|uniq|wc -l`
make -j$cpu&&make install

删除原配置文件并写入新的配置文件

rm -rf /etc/my.cnf
touch /etc/my.cnf
vi /etc/my.cnf

写入以下内容

[client]
port        = 3306
socket      = /tmp/mysql.sock
[mysqld]
port        = 3306
socket      = /tmp/mysql.sock
user = mysql
basedir = /usr/local/mysql
datadir = /home/mysql/data
pid-file = /home/mysql/data/mysql.pid
log_error = /home/mysql/data/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /home/mysql/data/mysql-slow.log
skip-external-locking
key_buffer_size = 32M
max_allowed_packet = 1024M
table_open_cache = 128
sort_buffer_size = 768K
net_buffer_length = 8K
read_buffer_size = 768K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
thread_cache_size = 16
query_cache_size = 16M
tmp_table_size = 32M
performance_schema_max_table_instances = 1000
explicit_defaults_for_timestamp = true
max_connections = 500
max_connect_errors = 100
open_files_limit = 65535
log_bin=mysql-bin
binlog_format=mixed
server_id   = 232
expire_logs_days = 10
early-plugin-load = ""
default_storage_engine = InnoDB
innodb_file_per_table = 1
innodb_buffer_pool_size = 128M
innodb_log_file_size = 32M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 32M
sort_buffer_size = 768K
read_buffer = 2M
write_buffer = 2M

加入环境变量和服务并加入开机启动


echo 'export PATH=/usr/local/mysql/bin:$PATH ' >>/etc/profile
source /etc/profile
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
systemctl enable mysqld


给权并初始化mysql

chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /home/mysql/data
cd /usr/local/mysql/bin
./mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/home/mysql/data

启动mysql

service mysqld start

测试

mysql -u root -p

输入密码是无问题的,直接按回车

接下来修改默认密码,改为osyum125874

ALTER USER 'root'@'localhost' IDENTIFIED BY 'osyum125874';
FLUSH PRIVILEGES;
quit;


完成。












121 0

评论