web123456

Linux installation mysql5.7.29 source code installation [Personal test]

1. Official website download address:

//Downloads/MySQL-5.7/mysql-boost-5.7.

【Included in this packageboost

 

2. Create an installation directory

mkdir -p /usr/local/mysql

mkdir -p /data/mysql/data

 

3. Create users and groups

groupadd mysql

useradd -g mysql mysql

 

4. Authorization

chown -R /usr/local/mysql

chown -R /data/mysql/data

 

 

5. Install dependency package

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

 

6. Cmake Compilation

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/ \

-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

 

7. Make compile

make && make install

【lscpu View the number of CPUs

make -j [need to add the number of compiled CPUs to improve the compilation speed] ]

 

 

8、vi /etc/

[mysqld]

basedir=/usr/local/mysql

datadir=/data/mysql/data

socket=/tmp/

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/

 

[client]

default-character-set = utf8

 

 

 

9. Initialization

cd /usr/local/mysql

./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/data/

 

 

10. Environment variable settings

echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile

source /etc/profile

 

 

11. Copy the startup file:

cp support-files/mysql.server /etc//mysqld

chmod 755 /etc//mysqld

 

12. Start the database:

/etc//mysqld start

 

 

13. Modify the temporary password

alter user 'root'@'localhost' identified by 'ki4@110';

 

 

14. Add to development services

chkconfig --add /etc//mysqld

 

15. Set up startup

chkconfig mysqld on

 

99. MySQL forgets root password

Solution:

1) Add skip-grant-tables to service mysqld restart

2) Execute after logging in

update set authentication_string=password(‘9kuy@110’) where user=‘root’;

flush privileges;

3) After successful execution, change the file back, restart MySQL, log in with a new password, and MySQL has been installed.

4) Then mysql can be connected, but the operation seems to be incomplete at this time, and you also need to change user...

mysql> alter user 'root'@'localhost' identified by '31kjh@110';