`
小于Brick
  • 浏览: 88962 次
  • 性别: Icon_minigender_1
  • 来自: 新疆
社区版块
存档分类
最新评论

centos7.2 安装 mysql5.7/mariadb5.5

阅读更多

 

参考:http://www.centoscn.com/image-text/install/2014/0909/3704.html

 

https://mariadb.com/kb/en/mariadb/yum/

 

mysql 和mariadb 的关系(来源于网络):

 

MySQL之父Widenius先生离开了Sun之后,觉得依靠Sun/Oracle来发展MySQL,实在很不靠谱,于是决定另开分支,这个分支的名字叫做MariaDB。
MariaDB跟MySQL在绝大多数方面是兼容的,对于开发者来说,几乎感觉不到任何不同。目前MariaDB是发展最快的MySQL分支版本,新版本发布速度已经超过了Oracle官方的MySQL版本。

MariaDB 是一个采用Aria存储引擎的MySQL分支版本,是由原来 MySQL 的作者Michael Widenius创办的公司所开发的免费开源的数据库服务器。[1]
这个项目的更多的代码都改编于 MySQL 6.0,例如 “pool of threads”功能提供解决多数据连接问题。

所以对于大部分的MySQL用户来说,从现在主流的MySQL转到MariaDB应该是没有什么难度的

=============================这里mariadb 是mysql5.5版本==========================

mariadb 安装:

yum -y install mariadb*  

 

安装完成后: 

开机自动开启服务:

[root@localhost ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@localhost ~]# systemctl start mariadb.service

 

 mysql 命令测试一下:
[root@localhost ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.50-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+

MariaDB [(none)]> use test
Database changed
MariaDB [test]> show tables;
Empty set (0.00 sec)

MariaDB [test]> exit
Bye

 

使用命令mysql_secure_installation安全配置:

[root@localhost ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation:行379: find_mysql_client: 未找到命令

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): (这里回车)
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: (密码)
Re-enter new password:(重复上面的密码) 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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.
(下面可以一路y下去了)
Remove anonymous users? [Y/n] y
 ... Success!

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? [Y/n] y
 ... Success!

By default, MariaDB 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? [Y/n] y
 - 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? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

以上就配置完成了!!! 

重新登录一下:

[root@localhost ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.50-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

 

确认一下是不是开机自启动:

 [root@localhost ~]# systemctl is-enabled mariadb
 enabled

 

 

 

数据库创建用户、授权请参考:http://youngbrick.iteye.com/blog/2335889

 

 

 

============下面通过oracle 官方yum源安装mysql5.7=======================

 

参考官方:https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html

参考: http://www.centoscn.com/mysql/2016/0626/7537.html

 

在这找你要的rpm版本:https://dev.mysql.com/downloads/repo/yum/

1、下载rpm

 

#wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

#rpm -ivh mysql57-community-release-el7-9.noarch.rpm
 2、安装mysql
#yum install mysql-community-server
 3、查看服务启动状态
#systemctl status mysqld
如果服务已经启动:就可以使用mysql了,默认密码是随机的
4、查看密码:
# grep 'temporary password' /var/log/mysqld.log 
[Note] A temporary password is generated for root@localhost: ,!8vdxgwZwvU
 我这里的密码是:(前面的一个空格忽略),【!8vdxgwZwvU
5、进入mysql:
#mysql -uroot -p 
6、修改密码:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
 这里修改会失败,提示:
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
 原因是密码策略问题,必须含有数字,小写或大写字母,特殊字符。只是为了自己测试,不想密码设置得那么复杂
7、修改密码策略:
mysql> set global validate_password_policy=0;
 
8、重复上面的修改密码:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
 
提示语句执行成功后,完成
 
 
备注:如果在mysql.log 中没有找到密码,那么加跳过授权表配置:# vim /etc/my.cnf
1、在[mysqld]的段中加上一句:skip-grant-tables=1
2、重启服务:systemctl restart msyqld
3、mysql -p  或  mysql -uroot    回程进入mysql
4、修改密码:
mysql> update mysql.user set authentication_string=password('123456!n') where user='root' and Host = 'localhost';
mysql> flush privileges ;
5、根据修改的帐号进入mysql
#mysql -uroot -p
6、需要alter再次修改密码,否则有问题:
mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY '123456!n';
mysql> flush privileges ;
最后ok
 ============================msyql版本升级==================================
https://dev.mysql.com/doc/refman/5.7/en/updating-yum-repo.html
 
 

 

 

分享到:
评论

相关推荐

    CentOS7.4安装mysql5.7

    ### CentOS 7.4 安装 MySQL 5.7 的详细步骤及注意事项 #### 一、安装流程 1. **进入指定目录** 首先,打开终端并进入到 `/usr/local/` 目录下: ```bash cd /usr/local/ ``` 2. **创建工具目录** 接着,...

    CentOS7.2 安装L2TP/IPSec 服务端/客户端 ( libreswan+xl2tpd )

    配套说明: http://blog.csdn.net/gogoytgo/article/details/79420745

    centos7安装mysql5.7

    在本地虚拟机的场合,需要更换yum安装网络地址配置文件CentOS-Base.repo 从阿里云服务器下载一份CentOS-Base.repo文件存到本地

    Centos6.7系统安装MySQL5.7总结

    Centos6.7系统安装MySQL5.7总结 本资源总结了在Centos6.7系统中安装MySQL5.7的步骤,包括下载和安装MySQL软件包,创建数据库仓库目录,新建MySQL用户和组,修改目录属有者,配置参数,修改系统配置文件,启动MySQL...

    CentOS安装MySQL5.7

    ### CentOS安装MySQL 5.7知识点详解 #### 一、环境准备与系统要求 在开始安装MySQL 5.7之前,我们需要确保系统满足以下条件: - **操作系统**:CentOS 7.x或更高版本。 - **硬件配置**:至少1GB内存,推荐2GB以上;...

    CentOs7下mysql5.7的下载安装以及主从同步、双主多从配置详情

    CentOs7 下 Mysql 5.7 的下载安装和主从同步、双主多从配置详解 CentOs 7 是一个流行的 Linux 操作系统,而 Mysql 5.7 是一个广泛使用的关系型数据库管理系统。本文将详细介绍如何在 CentOs 7 下下载安装 Mysql 5.7...

    centos系统安装mysql5.7

    CentOS 系统安装 MySQL 5.7 在本文中,我们将指导您如何在 CentOS 6.8 系统中安装 MySQL 5.7。MySQL 是一个流行的关系数据库管理系统,广泛应用于各种 web 应用程序中。 检测系统是否自带安装 MySQL 在安装 MySQL...

    centos7安装配置mysql5.7教程全

    MySQL安装后,需要进行一些安全配置,如设置root用户的密码,删除匿名用户等,运行`sudo mysql_secure_installation`。 四、连接MySQL 1. 首次安装后,root用户没有密码。可以使用`sudo mysql -u root`进入MySQL...

    Centos7安装mysql5.7yum list installed - grep mysql

    在CentOS7上安装MySQL 5.7是一个常见的任务,特别是在搭建服务器环境时。本文将详细解释如何通过YUM在CentOS7上安装MySQL 5.7.11,并涵盖安装过程中的关键步骤。 首先,我们需要确保系统中没有预装的MySQL。运行`...

    MySQL5.7在CentOS7.2上的安装配置

    MySQL 5.7 在 CentOS 7.2 上的安装配置 MySQL 5.7 在 CentOS 7.2 上的安装配置是一个复杂的过程,需要进行一步步的操作。在这个过程中,需要安装 MySQL 服务器、初始化数据库、启动数据库、配置数据库等步骤。 ###...

    centos7.1安装mysql5.7.rar

    本教程将详细介绍如何在CentOS 7.1上安装MySQL 5.7,这对于搭建稳定的Web服务环境至关重要。下面我们将深入探讨这个过程中的关键步骤和相关知识点。 首先,确保系统已经更新到最新版本,因为这有助于解决可能存在的...

    centos7二进制安装MySQL5.7.docx

    CentOS 7上二进制安装MySQL 5.7的过程涉及多个步骤,这些步骤确保了数据库服务能够正确、稳定地运行。以下是对整个过程的详细解释: 1. **安装依赖包**: 在安装MySQL之前,需要确保系统中有必要的依赖库。在...

    Centos 7安装MySQL 5.7

    本文将详细介绍 Centos 7 安装 MySQL 5.7 的步骤,包括下载并添加存储库、安装 MySQL 5.7 包、启动 MySQL Server、开机启动 MySQL Server、查看 MySQL Server 运行状况、获取 MySQL Server 的初始密码、提高 MySQL ...

    CentOS7.2安装MySql5.7并开启远程连接授权的教程

    主要介绍了CentOS7.2安装MySql5.7并开启远程连接授权的教程,本文图文并茂给大家介绍的非常详细,具有一定的参考借鉴价值 ,需要的朋友可以参考下

    centos安装mysql5.7.docx

    CentOS 7.6 安装 MySQL 5.7 MySQL 是一个开源的关系数据库管理系统,广泛应用于 web 开发中。下面是 CentOS 7.6 安装 MySQL 5.7 的步骤。 安装 MySQL 首先,需要新建文件夹 `/opt/mysql` 并 cd 进去。然后,下载...

    centos 7.2 离线安装 mysql 5.7.32 依赖包及xtrabackup 2.4.20依赖包

    centos 7.2 离线安装 mysql 5.7.32 依赖包及xtrabackup 2.4.20依赖包, tar -xzvf 文件名 使用 yum localinstall *.rpm 即可。 再centos7.8上安装,发现缺少pyparsing,因此又加入pyparsing包。

    Centos7安装mysql5.7.doc

    在本文中,我们将详细探讨如何在CentOS 7操作系统上安装MySQL 5.7数据库管理系统。MySQL是一个流行的开源关系型数据库管理系统(RDBMS),在Linux系统中广泛使用。以下是安装MySQL 5.7的步骤: 1. **准备工作**: ...

    Centos7下mysql5.7安装步骤.zip

    这里我们将详细探讨在CentOS 7上安装MySQL 5.7的完整流程,以及与Java相关的配置。 首先,为了安装MySQL 5.7,我们需要更新系统的软件包列表,以确保获取最新的依赖项。打开终端并执行以下命令: ```bash sudo yum...

    Centos7.2下使用YUM快速安装MySQL5.7的方法

    这篇文章将详细讲解如何使用YUM包管理器在CentOS 7.2上快速安装MySQL 5.7。 首先,确保系统已经更新至最新版本,可以通过运行`sudo yum update`命令来完成。接下来,我们需要卸载可能已安装的其他MySQL变体,例如...

    Centos7使用MySQL Yum安装MySQL 5.7

    Centos7使用MySQL Yum安装MySQL 5.7。参考文档:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/ MySQL Yum存储库下载:http://dev.mysql.com/downloads/repo/yum/

Global site tag (gtag.js) - Google Analytics