mysql 8安装

1, 打开官方网站,下载mysql

https://dev.mysql.com/downloads/file/?id=495278

公司内部SERVER,无法连外网,采用源码包

 安装步骤:

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar xvf /path/to/mysql-VERSION-OS.tar.xz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql
2020-06-01T09:53:48.853319Z 0 [System] [MY-013169] [Server] /export/servers/mysql-8.0.20-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.20) initializing of server in progress as process 35791
2020-06-01T09:53:48.861698Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-06-01T09:54:01.517524Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-06-01T09:54:11.657038Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: z1HI0j(?!h/n
shell> bin/mysql_ssl_rsa_setup
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

登陆: 使用刚刚初始化生成的密码:z1HI0j(?!h/n

登陆后必须要修改初始密码,否则其他的命令都无法执行; 会报错:ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

修改初始密码的SQL: alter user root@localhost identified by 'password';

root@A01-R07-07-I133-131 mysql]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.20

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> 
mysql> 
mysql> select @@version;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> 
mysql> alter user root@localhost identified by 'root01';
Query OK, 0 rows affected (0.17 sec)

mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 8.0.20    |
+-----------+
1 row in set (0.00 sec)

查看版本,显示8.0.20

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值