安装mysql-5.7.25-linux-glibc2.12

该博客转自https://blog.yoodb.com/yoodb/article/detail/1517,感谢老铁!!!!!

安装mysql-5.7.25-linux-glibc2.12

在减压包的时候注意将包压缩到 、/usr/local/ 下面

在官网:http://dev.mysql.com/downloads/mysql/ 中,选择以下版本的mysql下载:

1.png

 

1、解压压缩包到目标位置

--解压压缩包

[root@ecs-1b35-0002 tools]# tar -zxvf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz

--移动并修改文件名

[root@ecs-1b35-0002 tools]# mv mysql-5.7.25-linux-glibc2.12-x86_64 /usr/local/mysql
[root@ecs-1b35-0002 mysql]# pwd

/home/usr/mysql

 

2、创建数据仓库目录

[root@ecs-1b35-0002 mysql]# mkdir data/mysql

新建mysql用户、组及目录

[root@ecs-1b35-0002 mysql]# groupadd mysql
[root@ecs-1b35-0002 mysql]# useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql

 

3、改变目录属有者

[root@ecs-1b35-0002 mysql]# chown -R mysql .
[root@ecs-1b35-0002 mysql]# chgrp -R mysql .
[root@ecs-1b35-0002 mysql]# chown -R mysql /data/mysql
[root@ecs-1b35-0002 data]# cd ..
[root@ecs-1b35-0002 mysql]# chown -R mysql data/mysql
[root@ecs-1b35-0002 mysql]# ls
bin  COPYING  data  docs  include  lib  man  README  share  support-files

 

4、配置参数

[root@ecs-1b35-0002 mysql]# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/mysql

2019-01-28T07:37:54.141689Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2019-01-28T07:37:54.468955Z 0 [Warning] InnoDB: New log files created, LSN=45790 2019-01-28T07:37:54.533436Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2019-01-28T07:37:54.599965Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9fcb80c7-22cf-11e9-92c7-fa163ef336d3. 2019-01-28T07:37:54.602975Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2019-01-28T07:37:54.603403Z 1 [Note] A temporary password is generated for root@localhost: q0_wqowE8gk5
 

此处需要注意记录生成的临时密码,如上文结尾处的:q0_wqowE8gk5

 

5、使用脚本工具生成密钥文件

[root@ecs-1b35-0002 mysql]# bin/mysql_ssl_rsa_setup  --datadir=/usr/local/mysql/data/mysql

Generating a 2048 bit RSA private key
......................................................................+++
..................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
..................................................................................+++
....................................................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
...............................................+++
....................................+++
writing new private key to 'client-key.pem'
-----

 

6、修改系统配置文件

[root@ecs-1b35-0002 mysql]# cd support-files/
[root@ecs-1b35-0002 support-files]# ls
magic  mysqld_multi.server  mysql-log-rotate  mysql.server
[root@ecs-1b35-0002 support-files]# cp mysql.server /etc/init.d/mysql

 

7、修改以下内容

[root@ecs-1b35-0002 mysql]# vi /etc/my.cnf

[mysqld]

init_connect='SET collation_connection = utf8_unicode_ci'

init_connect='SET NAMES utf8'

character-set-server=utf8

port=3307

datadir=/usr/local/mysql/data/mysql

skip-grant-tables

[root@ecs-1b35-0002 mysql]# /etc/init.d/mysql start

Starting MySQL.Logging to '/home/yoodb/mysql/data/mysql/ecs-1b35-0002.novalocal.err'.

 SUCCESS! 

 

8、启动mysql

[root@ecs-1b35-0002 mysql]#  ln -s /usr/local/mysql/bin/mysql /usr/bin
[root@ecs-1b35-0002 my.cnf.d]# service mysql start
[root@ecs-1b35-0002 mysql]# mysql -hlocalhost -uroot -p
Enter password: 输入生成的临时密码
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.25
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> set password=password('yoodb123!@#');
Query OK, 0 rows affected, 1 warning (0.00 sec)
--设置root账户的host地址(修改可以远程连接)
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Bye

这样就可以使用远程连接数据了。

 

9、添加系统路径

# vim /etc/profile

添加:

export PATH=/home/yoodb/mysql/bin:$PATH
[root@ecs-1b35-0002 mysql]# source /etc/profile

 

10、配置mysql自动启动

[root@ecs-1b35-0002 mysql]# chmod 755 /etc/init.d/mysql
[root@ecs-1b35-0002 mysql]# chkconfig --add mysql
[root@ecs-1b35-0002 mysql]# chkconfig --level 345 mysql on

 

或者另一种安装方式:https://www.2cto.com/database/201806/755762.html

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 这两个文件都是MySQL 8.0.32的Linux版本,但它们的格式不同。mysql-8.0.32-linux-glibc2.12-x86_64.tar.xz是一种更有效的压缩格式,它可以减少文件的大小,但是你需要特定的解压缩工具才能解压它。mysql-8.0.32-linux-glibc2.12-x86_64.tar是一种普通的压缩格式,通常你可以使用标准的解压缩工具来解压它。 ### 回答2: mysql-8.0.32-linux-glibc2.12-x86_64.tar.xz和mysql-8.0.32-linux-glibc2.12-x86_64.tar的区别在于文件格式和压缩类型。 首先,mysql-8.0.32-linux-glibc2.12-x86_64.tar.xz是使用xz压缩工具对文件进行压缩而成的,而mysql-8.0.32-linux-glibc2.12-x86_64.tar则没有经过压缩。 其次,xz是一种高压缩率的文件压缩格式,可以将文件大小大大减小,节省存储空间。而未经过压缩的tar文件大小较大,保存在磁盘上需要更多的空间。 另外,xz压缩工具通常提供更好的压缩效率和速度,但解压缩所需的时间较长。相比之下,tar文件无需解压缩直接可以使用,更加方便。 在选择使用哪个文件时,需要根据具体的需求和环境来考虑。如果磁盘空间有限或需要节省存储空间,则可以选择使用已压缩的tar.xz文件。而如果磁盘空间充足,或需要更快速地使用该文件,则可以选择使用未经压缩的tar文件。 ### 回答3: mysql-8.0.32-linux-glibc2.12-x86_64.tar.xz 和mysql-8.0.32-linux-glibc2.12-x86_64.tar这两个文件的区别在于它们的文件格式。 首先,两个文件都是MySQL 8.0.32版本的安装包。这是一个常用的关系型数据库管理系统,用于存储和管理数据。 其次,两个文件的名称中包含的信息相同,都表示这是Linux操作系统上的MySQL 8.0.32版本。x86_64表示这个安装包适用于64位的x86架构。glibc2.12表示所需的glibc库的最低版本是2.12。 最重要的区别在于文件的扩展名。第一个文件是以.tar.xz结尾,而第二个文件则是以.tar结尾。 .tar是一种常见的打包格式。它是一种归档格式,可以将多个文件或文件夹打包成一个单独的文件。.tar文件可以使用tar命令进行解压和解包。 而.tar.xz格式则是在.tar文件的基础上进行了压缩。它使用XZ算法对.tar文件进行了压缩,使得文件更小,占用更少的存储空间。为了使用.tar.xz文件,需要事先安装xz工具,并使用tar和xz命令进行解压和解包。 因此,如果我们希望在Linux操作系统上安装MySQL 8.0.32,我们可以根据自己的需求选择这两个文件中的一个。如果我们对存储空间有要求,可以选择.tar.xz文件,但在使用之前需要先解压和解包。如果我们对存储空间没有特别要求,可以选择.tar文件,这样可以省去解压和解包的步骤。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值