centos7 mysql安装
一、系统环境
[root@localhost home]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
二、mysql安装
安装mysql和mysql-devel都成功,但是安装mysql-server失败,如下:
[root@localhost home]# yum install mysql-server
已加载插件:fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): base/7/x86_64/group_gz | 155 kB 00:00:01
(2/4): extras/7/x86_64/primary_db | 139 kB 00:00:01
(3/4): base/7/x86_64/primary_db | 5.6 MB 00:00:38
(4/4): updates/7/x86_64/primary_db | 4.7 MB 00:00:39
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
没有可用软件包 mysql-server。
错误:无须任何处理
出现这样问题是CentOS 7 版本将MySQL数据库软件从默认的程序列表中移除,用mariadb代替了
有两种解决办法:
1、方法一:安装mariadb
MariaDB数据库管理系统是MySQL的一个分支,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。MariaDB由MySQL的创始人Michael Widenius(英语:Michael Widenius)主导开发,他早前将自己创建的公司MySQL AB卖给了SUN,此后,随着SUN被甲骨文收购,MySQL的所有权也落入Oracle的手中。MariaDB名称来自Michael Widenius的女儿Maria的名字。
安装mariadb,输入安装命令
[root@localhost home]# yum install mariadb-server mariadb
mariadb数据库的相关命令是:
systemctl start mariadb #启动MariaDB
systemctl stop mariadb #停止MariaDB
systemctl restart mariadb #重启MariaDB
systemctl enable mariadb #设置开机启动
先启动数据库
[root@yl-web yl]# systemctl start mariadb
默认无密码
[root@localhost lzh]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.52-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 |
+--------------------+
4 rows in set (0.01 sec)
2、方法二:官网下载安装mysql-server
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
安装成功后重启mysql服务
# service mysqld restart
初次安装mysql,root账户没有密码
[root@localhost lzh]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.26 MySQL Community Server (GPL) Copyright (c) 2000, 2015, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.01 sec)
设置密码
mysql> set password for 'root'@'localhost' =password('password');
Query OK, 0 rows affected (0.00 sec)
安装完以后mariadb自动就被替换了,将不再生效。
[root@localhost lzh]# rpm -qa |grep mariadb
centos7 mysql安装的更多相关文章
- CENTOS7 mysql 安装
CentOS7的yum源中默认好像是没有mysql的.为了解决这个问题,我们要先下载mysql的repo源. 1. 下载mysql的repo源 $ wget http://repo.mysql.com ...
- [mysqld_safe]centos7 mysql 安装与配置
查资料发现是CentOS 7 版本将MySQL数据库软件从默认的程序列表中移除,用mariadb代替了. 有两种解决办法: 安装mariadb [root@a ~]# yum install mar ...
- centos7 mysql安装与用户设置
1.环境:Centos 7.0 64位2.mysql版本:5.73.安装:https://dev.mysql.com/doc/refman/5.7/en/installing.html3.1.创建my ...
- CentOS7 Hive 安装
hive的安装模式有2种,一种是使用自带的derby数据库,另一种是使用mysql作为元数据库.derby方式一般没人用,因为它是单用户模式.这里主要讲解mysql方式. hive仅仅是一个客户端工具 ...
- CentOS7下一个mysql安装
CentOS7安装MySQL --下载mysql http://mirrors.sohu.com/mysql/MySQL-5.6/ http://mirrors.sohu.com/mysql/MySQ ...
- 阿里云CentOS-7.2安装mysql
我下载的阿里云的服务器系统centos7.2是纯内核版本,并没有其他的工具,所以这个系统是非常干净的.所以我就需要给系统安装一一些工具,来方便系统的管理与操作,我们上面讲到了关于服务器的yum的配置在 ...
- CentOS7下安装MySQL并配置远程连接
一.CentOS7下安装MySQL数据库 CentOS7默认的安装包里面已经没有 MySQL-Server安装包了,远程镜像中也没有了. 默认的是MariaDB (MySQL的一个分支,开发这个分支的 ...
- CentOS7.4安装MySQL踩坑记录
CentOS7.4安装MySQL踩坑记录 time: 2018.3.19 CentOS7.4安装MySQL时网上的文档虽然多但是不靠谱的也多, 可能因为版本与时间的问题, 所以记录下自己踩坑的过程, ...
- linux centos7下mysql安装--韩国庆
首先我先给大家介绍下MariaDB和mysql的区别. 上图,“MySQL之父”的骨灰级程序员Monty,但是mysql被Oracle收购后,Monty又开始去发展另一条数据库的道路,并且以Monty ...
随机推荐
- 在多台PC上进行ROS通讯-学习笔记
首先,致谢易科(ExBot)和ROSWiki中文社区. 重要参考文献: Running ROS across multiple machines http://wiki.ros.org/ROS/Tut ...
- SpriteBuilder中关节的Breaking force属性
在SpriteBuilder中三种物理关节都包含Breaking force区域在属性框中. 该属性被设置成关节可以承受的压力临界值.如果关节的压力超出了Breaking force中设置的值,则关节 ...
- java面试之常见编程题
1.编程实现:二分搜索算法 解答: public class SearchTest { /** 被搜索数据的大小 */ private static final int size = 5000000; ...
- The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
The type java.lang.Object cannot be resolved.It is indirectly referenced from required .class files ...
- 和菜鸟一起学linux总线驱动之i2c死锁问题
不知不觉中已经有好几个月没有写点东西了,懒了就是懒了,说是忙着想把产品做得更好,都是借口,每天花一点时间来写点东西确实很不错,自己也坚持了很久很久,只不过今年以来,发现提高不是很大,能写的东西好少好少 ...
- Qt5中this application has requested the runtime to terminate it in an unusual way 无法运行问题的解决
在windows平台使用Qt5.8mingw版写出的程序,在Qt中运行正常,而以release的形式编译并且补充完必要的dll文件后,在其他电脑上运行出现了以下问题: 经过查阅许多资料和亲身实验,终于 ...
- 清楚css浮动的三种方法
第一种:添加新元素,应用clear:both; <div class="clear"></div> css样式:clear:both; 第二种:在浮动元素 ...
- React 深入系列5:事件处理
文:徐超,<React进阶之路>作者 授权发布,转载请注明作者及出处 React 深入系列5:事件处理 React 深入系列,深入讲解了React中的重点概念.特性和模式等,旨在帮助大家加 ...
- JS(作用域和闭包)
1.对变量提升的理解 1.变量定义(上下文) 2.函数声明 2.说明 this 几种不同的使用场景 常见用法 1.作为构造函数执行 2.作为对象属性执行 3.作为普通函数执行(this === win ...
- 深入理解SpringCloud之配置刷新
我们知道在SpringCloud中,当配置变更时,我们通过访问http://xxxx/refresh,可以在不启动服务的情况下获取最新的配置,那么它是如何做到的呢,当我们更改数据库配置并刷新后,如何能 ...