内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

centos7系統(tǒng)mysql數(shù)據庫如何安裝及配置

本文主要給大家介紹centos7系統(tǒng) MySQL數(shù)據庫如何安裝及配置,希望可以給大家補充和更新些知識,如有其它問題需要了解的可以持續(xù)在創(chuàng)新互聯(lián)行業(yè)資訊里面關注我的更新文章的。

明溪ssl適用于網站、小程序/APP、API接口等需要進行數(shù)據傳輸應用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:028-86922220(備注:SSL證書合作)期待與您的合作!

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

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

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

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

二、mysql安裝

一般網上給出的資料都是

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

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

centos7系統(tǒng) mysql數(shù)據庫如何安裝及配置

centos7系統(tǒng) mysql數(shù)據庫如何安裝及配置

[root@yl-web yl]# yum install mysql-serverLoaded 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

centos7系統(tǒng) mysql數(shù)據庫如何安裝及配置

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

有兩種解決辦法:

1、方法一:安裝mariadb

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

安裝mariadb,大小59 M。

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

mariadb數(shù)據庫的相關命令是:

systemctl start mariadb  #啟動MariaDB

systemctl stop mariadb  #停止MariaDB

systemctl restart mariadb  #重啟MariaDB

systemctl enable mariadb  #設置開機啟動

所以先啟動數(shù)據庫

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

然后就可以正常使用mysql了

centos7系統(tǒng) mysql數(shù)據庫如何安裝及配置

[root@yl-web yl]# mysql -u root -pEnter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3Server 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)]>

centos7系統(tǒng) mysql數(shù)據庫如何安裝及配置

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

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賬戶沒有密碼。

centos7系統(tǒng) mysql數(shù)據庫如何安裝及配置

[root@yl-web yl]# mysql -u root Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3Server 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>

centos7系統(tǒng) mysql數(shù)據庫如何安裝及配置

設置密碼

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

mysql>

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

在mysql安裝過程中如下內容:

centos7系統(tǒng) mysql數(shù)據庫如何安裝及配置

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

centos7系統(tǒng) mysql數(shù)據庫如何安裝及配置

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

[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中一致。

centos7系統(tǒng) mysql數(shù)據庫如何安裝及配置

2、遠程連接設置

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

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

如果是新用戶而不是root,則要先新建用戶

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

此時就可以進行遠程連接了。

看了以上關于centos7系統(tǒng) mysql數(shù)據庫如何安裝及配置,希望能給大家在實際運用中帶來一定的幫助。本文由于篇幅有限,難免會有不足和需要補充的地方,如有需要更加專業(yè)的解答,可在官網聯(lián)系我們的24小時售前售后,隨時幫您解答問題的。

網站標題:centos7系統(tǒng)mysql數(shù)據庫如何安裝及配置
文章網址:http://www.rwnh.cn/article38/ihjpsp.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供網站策劃、標簽優(yōu)化網站建設搜索引擎優(yōu)化、Google、ChatGPT

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網站優(yōu)化
新密市| 嵊泗县| 珠海市| 廉江市| 延长县| 肃南| 同江市| 澄城县| 巴南区| 肇源县| 奇台县| 安泽县| 民勤县| 固阳县| 通州区| 西藏| 吉林省| 西乡县| 东城区| 长丰县| 岐山县| 双牌县| 婺源县| 东宁县| 扎赉特旗| 左贡县| 渭源县| 汉中市| 长顺县| 大庆市| 丰宁| 牟定县| 嘉黎县| 刚察县| 汝南县| 波密县| 阜康市| 西藏| 明星| 香格里拉县| 工布江达县|