Linux下安装mysql-8.0.21-linux-glibc2.12-x86_64.tar安装步骤
1、解压MySQL mysql-8.0.21-linux-glibc2.12-x86_64.tar
创新互联公司专业为企业提供浮山网站建设、浮山做网站、浮山网站设计、浮山网站制作等企业网站建设、网页设计与制作、浮山企业网站模板建站服务,10年浮山做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
解压
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*9O9uj
记录上步骤的临时登录密码 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';
当前题目:Linux下安装mysql-8.0.21-linux-glibc2.12-x86_64.tar安装步骤
文章来源:http://myzitong.com/article/pocshe.html