MySQL5.7.32 source installation

MySQL source installation

1. Download the source code from MySQL official website

https://dev.mysql.com/downloads/mysql/

Insert picture description here

2.- Use steps

1. Install

  • Installation dependent environment
yum   -y  install  gcc*   cmake  bison  ncurses-devel openssl-devel

Insert picture description here

  • Create users, user groups
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -r -g mysql mysql
  • Create MySQL file directory, MySQL data directory
[root@localhost ~]# mkdir /opt/mysql
[root@localhost ~]# mkdir /data/mysqldb -p
  • Authorization
[root@localhost bin]# chown -R mysql mysql /opt/mysql
[root@localhost bin]# chown -R mysql mysql /data/mysqldb
  • mysql------.tar to decompress
 tar zxvf mysql-5.7.32.tar.gz  -C /usr/src/

Insert picture description here

  • Configuration
cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql -DMYSQL_UNIX_ADDR=/opt/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DWITH_BOOST=./boost
  • Compile && install
make && make install

Insert picture description here
Insert picture description here
Insert picture description here

  • Initialize the database
[root@localhost bin]# pwd
/opt/mysql/bin

Insert picture description here

[root@localhost bin]# ./mysqld --initialize --user=mysql --basedir=/opt/mysql/ --datadir=/data/mysqldb/

Insert picture description here

  • Start the database
[root@localhost bin]# service mysqld start

Insert picture description here

  • Enter the database
[root@localhost bin]# mysql -u root -p

Insert picture description here
Insert picture description here

  • Change the default password
mysql> set password=password('新密码');

Insert picture description here

  • End
    Insert picture description here

2. Configuration error

Insert picture description here

解决  yum -y install openssl-devel

3. Attention

可能会出现没有/etc 或support-files  没有  my.cnf文件的情况,可在其他版本中替换my-medium.cnf 文件。  

Guess you like

Origin blog.csdn.net/weixin_45846160/article/details/110736548