Linux安装MySQL8.0

10 篇文章 0 订阅
在RHEL6系统中,下载并解压MySQL 8.0安装包,完成初始化设置,包括创建数据目录、设置权限及生成临时密码。随后启动MySQL服务,并修改root用户的主机名和密码,确保远程访问。最后更新用户表,允许root用户从任何主机连接。
摘要由CSDN通过智能技术生成

1、https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz 下载mysql安装包

[root@rhel6lhr local]# cd -
/data
[root@rhel6lhr data]# ls
apache-tomcat-7.0.79        mysql
apache-tomcat-7.0.79.zip    mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz
jdk1.8.0_291                mysql-8.0.25-1.el6.x86_64.rpm-bundle.tar
jdk-8u291-linux-x64.tar.gz
[root@rhel6lhr data]# tar -zxvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz
[root@rhel6lhr data]# mv mysql-8.0.11-linux-glibc2.12-x86_64 mysql8.0
[root@rhel6lhr data]# chown -R mysql.mysql mysql8.0/
[root@rhel6lhr mysql8.0]# ./bin/mysqld --initialize --basedir=/data/mysql8.0 --datadir=/data/mysql8.0/data --user=mysql
2021-06-23T16:32:33.928437Z 0 [System] [MY-013169] [Server] /data/mysql8.0/bin/mysqld (mysqld 8.0.11) initializing of server in progress as process 22211
2021-06-23T16:32:36.076474Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Bkqzp:sri0lx
2021-06-23T16:32:36.896864Z 0 [System] [MY-013170] [Server] /data/mysql8.0/bin/mysqld (mysqld 8.0.11) initializing of server has completed


[root@rhel6lhr mysql]# service mysql start
Starting MySQL.[  OK  ]
[root@rhel6lhr mysql]# service mysql status;
MySQL running (23535)[  OK  ]
[root@rhel6lhr mysql8.0]# pwd
/data/mysql8.0
[root@rhel6lhr mysql8.0]# ./bin/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.11

Copyright (c) 2000, 2018, 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> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
Query OK, 0 rows affected (0.03 sec)
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> select 'host' from user where user='root';
+------+
| host |
+------+
| host |
+------+
1 row in set (0.00 sec)

mysql> update user set host = '%' where user ='root';
Query OK, 1 row affected (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> select 'host'   from user where user='root';
+------+
| host |
+------+
| host |
+------+
1 row in set (0.00 sec)

mysql> exit
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值