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

Centos7 mysql數(shù)據(jù)庫安裝及配置實現(xiàn)教程

 更新時間:2020年08月26日 11:10:34   作者:starof  
這篇文章主要介紹了Centos7 mysql數(shù)據(jù)庫安裝及配置實現(xiàn)教程,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下

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

yum update升級以后的系統(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ù)庫軟件從默認(rèn)的程序列表中移除,用mariadb代替了。

有兩種解決辦法:

1、方法一:安裝mariadb

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

安裝mariadb,大小59 M。

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

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

systemctl start mariadb #啟動MariaDB

systemctl stop mariadb #停止MariaDB

systemctl restart mariadb #重啟MariaDB

systemctl enable mariadb #設(shè)置開機啟動

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

[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)]>,可能看起來有點不習(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賬戶沒有密碼。

[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ù)庫即可生效。

在mysql安裝過程中如下內(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自動就被替換了,將不再生效。

[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、遠程連接設(shè)置

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

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

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

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

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

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

相關(guān)文章

  • Linux用戶自定義at、cron計劃任務(wù)執(zhí)行的方法

    Linux用戶自定義at、cron計劃任務(wù)執(zhí)行的方法

    今天小編就為大家分享一篇Linux用戶自定義at、cron計劃任務(wù)執(zhí)行的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-07-07
  • Linux下為PHP添加擴展庫的方法

    Linux下為PHP添加擴展庫的方法

    我剛剛開始學(xué)習(xí)lnmp環(huán)境,對php編譯的參數(shù)基本上都不知道,在網(wǎng)上看了很多教程,看到在編譯PhP的時候都還了很多參數(shù),也在網(wǎng)上查了這些參數(shù)是什么意思,但是卻不知道,哪些參數(shù)必須要加上,哪些參數(shù)不需要加
    2012-09-09
  • Linux VPS配置Web網(wǎng)站環(huán)境一鍵包(LNMP/LAMP/LNMPA)

    Linux VPS配置Web網(wǎng)站環(huán)境一鍵包(LNMP/LAMP/LNMPA)

    如果我們是資深Linux用戶,可能不屑于網(wǎng)上免費Linux Web一鍵包、管理面板的安裝,然后自己編譯或者自由的一套環(huán)境安裝配置環(huán)境。但是,對于大部分用戶而言,麥子個人建議還是選擇較為成熟的WEB一鍵包或者面板安裝環(huán)境
    2017-02-02
  • Linux下自動刪除歸檔日志文件的方法

    Linux下自動刪除歸檔日志文件的方法

    這篇文章主要介紹了Linux下自動刪除歸檔日志文件的方法,非常不錯,具有參考借鑒價值,需要的朋友參考下吧
    2016-12-12
  • linux中定時任務(wù)crond命令使用方法

    linux中定時任務(wù)crond命令使用方法

    這篇文章主要為大家詳細介紹了linux中定時任務(wù)crond命令的使用方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-02-02
  • Linux如何運行Jar包命令

    Linux如何運行Jar包命令

    這篇文章主要介紹了Linux如何運行Jar包命令問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-05-05
  • 詳解linux 關(guān)機命令總結(jié)

    詳解linux 關(guān)機命令總結(jié)

    本篇文章主要介紹了linux 關(guān)機命令總結(jié),linux下常用的關(guān)機命令有:shutdown、halt、poweroff、init,有興趣的可以了解一下。
    2016-12-12
  • Linux下如何永久修改主機名的方法步驟

    Linux下如何永久修改主機名的方法步驟

    這篇文章主要介紹了Linux下如何永久修改主機名的方法步驟,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-01-01
  • linux中通過文件描述符獲取文件絕對路徑的方法

    linux中通過文件描述符獲取文件絕對路徑的方法

    下面小編就為大家?guī)硪黄猯inux中通過文件描述符獲取文件絕對路徑的方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-12-12
  • Linux VPS備份教程 數(shù)據(jù)庫/網(wǎng)站文件自動定時備份

    Linux VPS備份教程 數(shù)據(jù)庫/網(wǎng)站文件自動定時備份

    這篇文章老左分享目前大家比較常用的自動定時備份方案,數(shù)據(jù)庫發(fā)送到我們的郵箱、文件發(fā)送同步到我們另外空間FTP中
    2012-09-09

最新評論