https://cdn.MySQL.com//Downloads/MySQL-5.7/mysql-boost-5.7.29.tar.gz
【此包中含boost】
mkdir -p /usr/local/mysql
mkdir -p /data/mysql/data
groupadd mysql
useradd -g mysql mysql
chown -R mysql.mysql /usr/local/mysql
chown -R mysql.mysql /data/mysql/data
yum -y install make gcc gcc-c++ cmake bison-devel ncurses ncurses-devel openssl-devel bison
cmake
-DWITH_BOOST=boost/boost_1_59_0
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_DATADIR=/data/mysql/data
-DSYSCONFDIR=/etc
-DWITH_MEMORY_STORAGE_ENGINE=1
-DWITH_MYISAM_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_READLINE=1
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock
-DMYSQL_TCP_PORT=3306
-DENABLED_LOCAL_INFILE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DEXTRA_CHARSETS=all
-DDEFAULT_CHARSET=utf8mb4
-DDEFAULT_COLLATION=utf8mb4_general_ci
-DWITH_SSL=system
make
【lscpu
make -j [需要添加编译的cpu数量,提高编译速度] 】
[mysqld]
basedir=/usr/local/mysql
datadir=/data/mysql/data
socket=/tmp/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
skip-name-resolve
#innodb_buffer_pool_size=2048M
max_connections=500
collation_server=utf8_bin
character_set_server=utf8
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
lower_case_table_names=0
key_buffer_size = 600M
max_allowed_packet = 100M
table_open_cache = 1024
sort_buffer_size = 6M
read_buffer_size = 6M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 64
query_cache_size = 256M
innodb_log_file_size = 1024M
innodb_log_files_in_group = 3
#log-error=/usr/local/mysql/log/mysqld.log
[client]
default-character-set = utf8
cd /usr/local/mysql
./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/data/
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
/etc/init.d/mysqld start
alter user 'root'@'localhost' identified by 'ik0@110';
chkconfig --add /etc/init.d/mysqld
chkconfig mysqld on
解决方法:
1)在my.cnf中加上skip-grant-tables后 service mysqld restart
2)登录后执行
update mysql.user set authentication_string=password(‘jew@110’) where user=‘root’;
flush privileges;
3)执行成功后将my.cnf 文件改回去,重启MySQL,使用新密码登录,MySQL已安装完成。
4)然后mysql就可以连接了,但此时操作似乎功能不完全,还要alter user…
mysql> alter user 'root'@'localhost' identified by 'qldassword(‘r31@110’) where user=‘root’;
flush privileges;
3)执行成功后将my.cnf 文件改回去,重启MySQL,使用新密码登录,MySQL已安装完成。
4)然后mysql就可以连接了,但此时操作似乎功能不完全,还要alter user…
mysql> alter user 'root'@'localhost' identified by 'qld@110';