mysql安装配置方法图文教程(CentOS7)
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了mysql安装配置方法图文教程(CentOS7),小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3700字,纯文字阅读大概需要6分钟。
内容图文
![mysql安装配置方法图文教程(CentOS7)](/upload/InfoBanner/zyjiaocheng/583/bfc4adeda4304e349c9ec4e14ac0edd4.jpg)
一、系统环境
[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代替了
有两种解决办法:
方法一:安装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)
方法二:官网下载安装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
精彩专题分享:mysql不同版本安装教程 mysql5.7各版本安装教程 mysql5.6各版本安装教程
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
您可能感兴趣的文章:
- SQL Server 使用触发器(trigger)发送电子邮件步骤详解
- mysql处理海量数据时的一些优化查询速度方法
- mysql数据库常见的优化操作总结(经验分享)
- Mysql中Join的使用实例详解
- mysql 5.7安装 MySQL 服务无法启动但是服务没有报告任何错误
- SQL 获取所有上级的实现方法
内容总结
以上是互联网集市为您收集整理的mysql安装配置方法图文教程(CentOS7)全部内容,希望文章能够帮你解决mysql安装配置方法图文教程(CentOS7)所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。