加入收藏 | 设为首页 | 会员中心 | 我要投稿 财气旺网 - 财气网 (https://www.caiqiwang.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

Linux下安装mysql-8.0.21-linux-glibc2.12-x86_64.tar安装过程

发布时间:2022-04-05 08:35:08 所属栏目:MySql教程 来源:互联网
导读:Linux下安装mysql-8.0.21-linux-glibc2.12-x86_64.tar安装过程: 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.
       Linux下安装mysql-8.0.21-linux-glibc2.12-x86_64.tar安装过程:

 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
 
记录上步骤的临时登录密码 root@localhost: 2fZkV6HGCi?
 
7.配置参数文件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.创建RSA private key bin/mysql_ssl_rsa_setup --datadir=/mysql/mysql8.21/data
 
9.如果初始密码忘了(root)
 
可以启动mysql跳过Mysql密码验证
 
/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';
 
把密码重置为空(此时还不能直接修改密码,必须先设置为空,否则会报错)
 
启动mysql 修改密码
 
alter user 'root'@'localhost' identified by 'mysql8.21';
 
10、 更新域属性,'%'表示允许外部访问:
 
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、授权
 
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'; 

(编辑:财气旺网 - 财气网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!