欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

centos7 mysql數(shù)據(jù)庫(kù)安裝和配置

 更新時(shí)間:2017年01月16日 09:54:48   作者:starof  
本篇文章主要介紹了centos7 mysql數(shù)據(jù)庫(kù)安裝和配置 ,非常具有實(shí)用價(jià)值,希望對(duì)大家實(shí)用mysql能夠有所幫助

一、系統(tǒng)環(huán)境

yum update升級(jí)以后的系統(tǒng)版本為

[root@yl-web yl]# cat /etc/redhat-release 
CentOS Linux release 7.1.1503 (Core) 

二、mysql安裝

一般網(wǎng)上給出的資料都是

#yum install mysql
#yum install mysql-server
#yum install mysql-devel

安裝mysql和mysql-devel都成功,但是安裝mysql-server失敗,如下: 

[root@yl-web yl]# yum install mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.sina.cn
 * extras: mirrors.sina.cn
 * updates: mirrors.sina.cn
No package mysql-server available.
Error: Nothing to do

查資料發(fā)現(xiàn)是CentOS 7 版本將MySQL數(shù)據(jù)庫(kù)軟件從默認(rèn)的程序列表中移除,用mariadb代替了。

有兩種解決辦法:

1、方法一:安裝mariadb

MariaDB數(shù)據(jù)庫(kù)管理系統(tǒng)是MySQL的一個(gè)分支,主要由開(kāi)源社區(qū)在維護(hù),采用GPL授權(quán)許可。開(kāi)發(fā)這個(gè)分支的原因之一是:甲骨文公司收購(gòu)了MySQL后,有將MySQL閉源的潛在風(fēng)險(xiǎn),因此社區(qū)采用分支的方式來(lái)避開(kāi)這個(gè)風(fēng)險(xiǎn)。MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能輕松成為MySQL的代替品。

安裝mariadb,大小59 M。

[root@yl-web yl]# yum install mariadb-server mariadb 

mariadb數(shù)據(jù)庫(kù)的相關(guān)命令是:

systemctl start mariadb #啟動(dòng)MariaDB

systemctl stop mariadb #停止MariaDB

systemctl restart mariadb #重啟MariaDB

systemctl enable mariadb #設(shè)置開(kāi)機(jī)啟動(dòng)

所以先啟動(dòng)數(shù)據(jù)庫(kù)

[root@yl-web yl]# systemctl start mariadb

然后就可以正常使用mysql了 

[root@yl-web yl]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.41-MariaDB MariaDB Server

Copyright (c) 2000, 2014, 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.00 sec)

MariaDB [(none)]> 

安裝mariadb后顯示的也是 MariaDB [(none)]> ,可能看起來(lái)有點(diǎn)不習(xí)慣。下面是第二種方法。

2、方法二:官網(wǎng)下載安裝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服務(wù)。

# service mysqld restart

初次安裝mysql,root賬戶(hù)沒(méi)有密碼。 

[root@yl-web yl]# 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> 

 設(shè)置密碼

mysql> set password for 'root'@'localhost' =password('password');
Query OK, 0 rows affected (0.00 sec)

mysql> 

不需要重啟數(shù)據(jù)庫(kù)即可生效。

在mysql安裝過(guò)程中如下內(nèi)容: 

Installed:
 mysql-community-client.x86_64 0:5.6.26-2.el7  mysql-community-devel.x86_64 0:5.6.26-2.el7  
 mysql-community-libs.x86_64 0:5.6.26-2.el7   mysql-community-server.x86_64 0:5.6.26-2.el7  

Dependency Installed:
 mysql-community-common.x86_64 0:5.6.26-2.el7          

Replaced:
 mariadb.x86_64 1:5.5.41-2.el7_0  mariadb-devel.x86_64 1:5.5.41-2.el7_0 mariadb-libs.x86_64 1:5.5.41-2.el7_0 
 mariadb-server.x86_64 1:5.5.41-2.el7_0 

所以安裝完以后mariadb自動(dòng)就被替換了,將不再生效。

[root@yl-web yl]# rpm -qa |grep mariadb
[root@yl-web yl]# 

三、配置mysql

1、編碼

mysql配置文件為/etc/my.cnf

最后加上編碼配置

[mysql]
default-character-set =utf8

這里的字符編碼必須和/usr/share/mysql/charsets/Index.xml中一致。

2、遠(yuǎn)程連接設(shè)置

把在所有數(shù)據(jù)庫(kù)的所有表的所有權(quán)限賦值給位于所有IP地址的root用戶(hù)。

mysql> grant all privileges on *.* to root@'%'identified by 'password';

如果是新用戶(hù)而不是root,則要先新建用戶(hù)

mysql>create user 'username'@'%' identified by 'password'; 

此時(shí)就可以進(jìn)行遠(yuǎn)程連接了。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 在 Linux 中不使用 CD 命令進(jìn)入目錄/文件夾的方法

    在 Linux 中不使用 CD 命令進(jìn)入目錄/文件夾的方法

    眾所周知,如果沒(méi)有 cd 命令,我們無(wú)法 Linux 中切換目錄。接下來(lái)通過(guò)本文給大家介紹了在 Linux 中不使用 CD 命令進(jìn)入目錄/文件夾的方法,需要的朋友可以參考下
    2019-04-04
  • Linux下的定時(shí)任務(wù)和延時(shí)任務(wù)的詳解

    Linux下的定時(shí)任務(wù)和延時(shí)任務(wù)的詳解

    這篇文章主要介紹了Linux下的定時(shí)任務(wù)和延時(shí)任務(wù),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • 詳解在Linux下9個(gè)有用的touch命令示例

    詳解在Linux下9個(gè)有用的touch命令示例

    本篇文章主要介紹了詳解在Linux下9個(gè)有用的touch命令示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-05-05
  • tomcat 5.5連接池配置,如何讓工程為默認(rèn)工程

    tomcat 5.5連接池配置,如何讓工程為默認(rèn)工程

    把驅(qū)動(dòng)程序拷貝到Tomcat 5.5\common\lib目錄下
    2009-06-06
  • 淺析centos 7 自帶的 php 5.4升級(jí)為 5.6的方法

    淺析centos 7 自帶的 php 5.4升級(jí)為 5.6的方法

    這篇文章主要介紹了centos 7 自帶的 php 5.4升級(jí)為 5.6的方法,需要的朋友可以參考下
    2018-12-12
  • Linux alias命令編寫(xiě)

    Linux alias命令編寫(xiě)

    這篇文章主要介紹了Linux alias命令編寫(xiě),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-08-08
  • linux下安裝boost庫(kù)的完整步驟記錄

    linux下安裝boost庫(kù)的完整步驟記錄

    Boost庫(kù)是一個(gè)經(jīng)過(guò)千錘百煉、可移植、提供源代碼的C++庫(kù),,作為標(biāo)準(zhǔn)庫(kù)的后備,是C++標(biāo)準(zhǔn)化進(jìn)程的發(fā)動(dòng)機(jī)之一,下面這篇文章主要給大家介紹了關(guān)于如何在linux下安裝boost庫(kù)的完整步驟,需要的朋友可以參考下
    2018-11-11
  • Linux crontab定時(shí)任務(wù)配置方法(詳解)

    Linux crontab定時(shí)任務(wù)配置方法(詳解)

    下面小編就為大家?guī)?lái)一篇Linux crontab定時(shí)任務(wù)配置方法(詳解)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2016-11-11
  • Linux服務(wù)器選擇什么版本好

    Linux服務(wù)器選擇什么版本好

    服務(wù)器選擇什么版本的linux,這個(gè)問(wèn)題是個(gè)老生常談的問(wèn)題,每個(gè)月都有人討論,根據(jù)我運(yùn)維過(guò)1000臺(tái) server的經(jīng)驗(yàn),回答如下
    2014-03-03
  • Linux查找包含指定文字的文件(linux查找指定文件)

    Linux查找包含指定文字的文件(linux查找指定文件)

    本文介紹Linux查找包含指定文字的文件命令(linux查找指定文件),大家參考使用吧
    2013-12-12

最新評(píng)論