fedora7 安装mysql_如何在CentOS 7/6,RHEL 7/6和Fedora 28/27/26上安装MySQL 8.0

MySQL是一个免费的开源数据库管理系统,常用于Web应用程序中,用于存储和检索记录和信息。

MySQL最初由MYSQL AB开发,现在由Oracle Corporation拥有。 它是Linux操作系统的主要数据库应用程序,直到MySQL的一个分支MariaDB才出现。

在本文中,我们将讨论如何在CentOS 7/6,RHEL 7/6和Fedora 28/27/26上安装MySQL 8.0的基本过程。

添加MySQL存储库

MySQL不再通过基本操作系统映像分发或在OS存储库中可用。 因此,您需要添加MySQL的官方存储库来安装MySQL社区服务器。

### CentOS 7 / RHEL 7 ###

rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

### CentOS 6 / RHEL 6 ###

rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm

### Fedora 28 ###

rpm -ivh https://dev.mysql.com/get/mysql80-community-release-fc28-1.noarch.rpm

### Fedora 27 ###

rpm -ivh https://dev.mysql.com/get/mysql80-community-release-fc27-1.noarch.rpm

### Fedora 26 ###

rpm -ivh https://dev.mysql.com/get/mysql80-community-release-fc26-1.noarch.rpm

确保使用以下命令添加并启用了MySQL存储库。

yum repolist all | grep mysql | grep enabled

输出:可能看起来像。

mysql-connectors-community/x86_64 MySQL Connectors Community enabled: 51

mysql-tools-community/x86_64 MySQL Tools Community enabled: 63

mysql80-community/x86_64 MySQL 8.0 Community Server enabled: 17

安装 MySQL Community Server

Oracle目前提供稳定版本(v8.0和v5.7)。 您可以选择要在计算机上安装的那个。

安装 MySQL 8.0

在CentOS/RHEL中使用yum命令,在Fedora中使用dnf命令安装最新的稳定版MySQL。

### CentOS 7/6 & RHEL 7/6 ###

yum -y install mysql-community-server

### Fedora 28/27/26 ###

dnf -y install mysql-community-server

安装 MySQL 5.7

如果您想尝试旧版本的MySQL,请在您的计算机上安装MySQL 5.7。

### CentOS 7/6 & RHEL 7/6 ###

yum -y install mysql-community-server --disablerepo=mysql80-community --enablerepo=mysql57-community

### Fedora 28/27/26 ###

dnf -y install mysql-community-server --disablerepo=mysql80-community --enablerepo=mysql57-community

启动 MySQL 服务

安装MySQL后,可以使用以下命令启动MySQL服务器。

### CentOS 7 / RHEL 7 / Fedora 28/27/26 ###

systemctl start mysqld

### CentOS 6 / RHEL 6 ###

service mysqld start

在系统启动时启用MySQL服务器。

### CentOS 7 / RHEL 7 / Fedora 28/27/26 ###

systemctl enable mysqld

### CentOS 6 / RHEL 6 ###

chkconfig mysqld on

使用以下命令验证是否已启动MySQL服务器。

### CentOS 7 / RHEL 7 / Fedora 28/27/26 ###

systemctl status mysqld

### CentOS 6 / RHEL 6 ###

service mysqld status

输出:

CentOS 7 / RHEL 7 / Fedora:

● mysqld.service - MySQL Server

Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

Active: active (running) since Fri 2018-12-04 19:19:36 EDT; 21s ago

Docs: man:mysqld(8)

http://dev.mysql.com/doc/refman/en/using-systemd.html

Main PID: 8452 (mysqld)

Status: "SERVER_OPERATING"

CGroup: /system.slice/mysqld.service

└─8452 /usr/sbin/mysqld

Dec 04 19:19:23 server.itzgeek.local systemd[1]: Starting MySQL Server...

Dec 04 19:19:36 server.itzgeek.local systemd[1]: Started MySQL Server.

CentOS 6 / RHEL 6 :

mysqld (pid 2258) is running...

MySQL服务器安全设置

在CentOS/RHEL/Fedora中,可以在/var/log/mysqld.log中找到初始的MySQL root密码。 您可以使用以下命令从日志文件中获取密码。

cat /var/log/mysqld.log | grep -i 'temporary password'

输出:

2017-11-25T07:02:29.549979Z 1 [Note] A temporary password is generated for root@localhost: Ed*Sn(6R9q0h

现在,您需要运行mysql_secure_installation来保护MySQL安装。 此命令负责设置root密码,删除匿名用户,远程禁止root登录等。

mysql_secure_installation

输出:

Securing the MySQL server deployment.

Enter password for user root: <== Enter Root password taken from previous step

The existing password for the user account root has expired. Please set a new password.

New password: <== Enter New Root Password

Re-enter new password: <== Re-Enter New Root Password

VALIDATE PASSWORD PLUGIN can be used to test passwords

and improve security. It checks the strength of password

and allows the users to set only those passwords which are

secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: No<== Already high secure enough

Using existing password for root.

Change the password for root ? ((Press y|Y for Yes, any other key for No) : no<== Since the password is already changed in previous step, type no.

... skipping.

By default, a MySQL installation has an anonymous user,

allowing anyone to log into MySQL without having to have

a user account created for them. This is intended only for

testing, and to make the installation go a bit smoother.

You should remove them before moving into a production

environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : yes<== Remove Anonymous userSuccess.

Normally, root should only be allowed to connect from

'localhost'. This ensures that someone cannot guess at

the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : yes<== Disable remote root loginSuccess.

By default, MySQL comes with a database named 'test' that

anyone can access. This is also intended only for testing,

and should be removed before moving into a production

environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : yes<== Remove test database - Dropping test database...

Success.

- Removing privileges on test database...

Success.

Reloading the privilege tables will ensure that all changes

made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : yes<== Reload PrivilegeSuccess.

All done!

使用MySQL服务器

使用root用户及其密码登录MySQL服务器。

mysql -u root -p

输出:

MySQL 8.0:

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 12

Server version: 8.0.11 MySQL Community Server - GPL

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>

MySQL 5.7:

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.7.22 MySQL Community Server (GPL)

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>

安装phpMyAdmin

phpMyAdmin是一个基于Web的开源管理工具,用于管理MySQL和MariaDB数据库。 按照以下链接,根据您的操作系统安装和配置phpMyAdmin。

0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值