編譯安裝mysql

準(zhǔn)備用戶并創(chuàng)建目錄,準(zhǔn)備實(shí)驗(yàn)環(huán)境

[root@localhost ~]# groupadd -r -g 306 mysql
[root@localhost ~]# useradd -r -g 306 -u 306 -d /data/mysql mysql
[root@localhost ~]# mkdir /data/mysql
[root@localhost ~]# chown mysql:mysql /data/mysql
[root@localhost ~]# yum install -y libaio perl-Data-Dumper  vim gcc gcc-c++ wget autoconf net-tools lrzsz curl policycoreutils openssh-server openssh-clients postfix  
[root@localhost ~]# tar xf ~/mysql-5.7.29-el7-x86_64.tar.gz -C /usr/local/
[root@localhost ~]# echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
[root@localhost ~]# source /etc/profile

開始安裝Mysql5.7

[root@localhost ~]# cd /usr/local/
[root@localhost ~]# mv /usr/local/src/mysql-5.7.29-el7-x86_64 /usr/local/mysql
[root@localhost src]# mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
2021-03-28T03:37:04.164075Z 1 [Note] A temporary password is generated for root@localhost: rk>bsXkum7ud
[root@localhost ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost ~]# chkconfig --add mysqld
[root@localhost ~]# chkconfig  mysqld on
[root@localhost ~]# chkconfig --list |grep mysqld

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@localhost ~]# /etc/init.d/mysqld start
Starting MySQL.Logging to '/data/mysql/mysql_error.log'.
.... SUCCESS! 
[root@localhost ~]# /usr/local/mysql/bin/mysql_secure_installation 
更改密碼

驗(yàn)證

[root@localhost ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29-log

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)


?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容