您好,登錄后才能下訂單哦!
1、解壓mysql mysql-8.0.21-linux-glibc2.12-x86_64.tar
解壓
tar -xvf mysql-8.0.21-linux-glibc2.12-x86_64.tar
tar -xvJf mysql-8.0.21-linux-glibc2.12-x86_64.tarr.xz
2、cp -r mysql-8.0.21-linux-glibc2.12-x86_64 mysql8.21/
3、添加用戶組 groupadd mysql
4、添加用戶積所屬用戶組 useradd -g mysql mysql
5、查看添加是否成功 id mysql
6. 初始化
bin/mysqld --initialize --user=mysql --basedir=/mysql/mysql8.21 --datadir=/mysql/mysql8.21/data
./mysqld --initialize --user=mysql --basedir=/mysql/mysql8.21 --datadir=/mysql/mysql8.21/data
2020-07-15T01:36:10.855350Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2020-07-15T01:36:10.855903Z 0 [System] [MY-013169] [Server] /mysql/mysql8.21/bin/mysqld (mysqld 8.0.21) initializing of server in progress as process 151504
2020-07-15T01:36:10.930218Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-07-15T01:36:13.983064Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-07-15T01:36:16.019130Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: u?B7*9O9&#uj
記錄上步驟的臨時(shí)登錄密碼 root@localhost: 2fZkV6HGCi?
7.配置參數(shù)文件my.cnf
vi /mysql/mysql8.21/support-files/my.cnf
[mysqld]
port = 3308
socket = /mysql/mysql8.21/run/mysql.sock
datadir = /mysql/mysql8.21/data
basedir=/mysql/mysql8.21/
default_storage_engine = InnoDB
max_connections = 2048
open_files_limit = 65535
max-connect-errors=100000
skip-name-resolve
character-set-server=utf8
log-error =mysql_error.log
log-bin =/mysql/mysql8.21/log/master-bin
log-bin-index=/mysql/mysql8.21/log/master-bin.index
slow_query_log = 1
slow_query_log_file =/mysql/mysql8.21/log/mysql_slow_query.log
long_query_time = 10
relay_log = /mysql/mysql8.21/log/master-relay-bin
server-id=101
relay-log-info-repository=TABLE
master-info-repository=TABLE
sync_binlog=1
sync_relay_log=1
log_slave_updates=1
8.創(chuàng)建RSA private key bin/mysql_ssl_rsa_setup --datadir=/mysql/mysql8.21/data
9.如果初始密碼忘了(root)
可以啟動(dòng)mysql跳過Mysql密碼驗(yàn)證
/mysql/mysql8.21/bin/mysqld_safe --defaults-file=/mysql/mysql8.21/support-files/my.cnf --skip-grant-tables
use mysql;
update user set authentication_string='' where user='root';
把密碼重置為空(此時(shí)還不能直接修改密碼,必須先設(shè)置為空,否則會(huì)報(bào)錯(cuò))
啟動(dòng)mysql 修改密碼
alter user 'root'@'localhost' identified by 'mysql8.21';
10、 更新域?qū)傩裕?#39;%'表示允許外部訪問:
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set host='%' where user ='root';
Query OK, 1 row affected (0.11 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> select host,user,plugin from user;
+-----------+------------------+-----------------------+
| host | user | plugin |
+-----------+------------------+-----------------------+
| % | root | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
11、授權(quán)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
Query OK, 0 rows affected (0.34 sec)
12、 mysql8.0以上 引入了新特性 caching_sha2_password;
這種密碼加密方式Navicat 12以下客戶端不支持;解決方法
修改加密方式
update user set plugin='mysql_native_password' where user='root';
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。