Linux下安装mysql-8.0.21-linux-glibc2.12-x86_64.tar安装步骤

发布时间:2020-08-10 03:28:26 作者:pingdanorcale
来源:ITPUB博客 阅读:1946

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'; 

推荐阅读:
  1. Linux下zabbix的安装步骤
  2. 关于win下Memcached安装步骤

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

64.tar linux 安装

上一篇:航天工业某重点企业

下一篇:the "in" use in mysql

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》