成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Linux 環境下快速部署 MySQL 的替代方案

原創
運維 系統運維
MariaDB 是一個采用 Maria 存儲引擎的 MySQL 分支版本,與 MySQL 相比較,MariaDB 更強的地方在于,二者支持的不同的引擎。通??梢酝ㄟ^show engines 命令來查看兩種數據庫服務器 支持的不同的引擎。本文主要講解了Linux 環境下快速部署 MySQL 的替代方案。

【51CTO專稿】一 MySQL 代替者MariaDB 簡介

MariaDB名稱來自Michael Widenius的女兒Maria的名字。圖1 是MariaDB 的LOGO:

圖1 MariaDB 的LOGO

MariaDB 下載:https://downloads.mariadb.org/

MariaDB 網站:http://www.mariadb.org/

MariaDB***穩定版為:MariaDB 5.5。上一個穩定版為:MariaDB 5.3。

MariaDB 是一個采用 Maria 存儲引擎的 MySQL 分支版本,與 MySQL 相比較,MariaDB 更強的地方在于,二者支持的不同的引擎。通??梢酝ㄟ^show engines 命令來查看兩種數據庫服務器 支持的不同的引擎。 Support列的信息包括YES,NO 和 DEFAULT。

圖2 和圖3 分別是MySQL 5.5 和MariaDB 5.5 引擎列表:

圖2 MySQL 5.5引擎列表

圖3 MariaDB 5.5 引擎列表

對比二者 Sphinx全文搜索引擎是目前當前市場上最炙手可熱的開源搜索引擎,MariaDB利用SphinxSE作為存儲引擎。另外MariaDB基于事務的Maria存儲引擎,替換了MySQL的MyISAM存儲引擎,它使用了Percona的 XtraDB,是InnoDB的變體。MariaDB默認的存儲引擎是Aria,不是MyISAM。Aria可以支持事務,但是默認情況下沒有打開事務支持,因為事務支持對性能會有影響。PBXT 是 MariaDB 附帶的一種存儲引擎,PBXT 在 MariaDB 的 5.1/5.2/5.3 版本中存在,但從 MariaDB 5.5 開始就不再提供 PBXT 存儲引擎,而且以后也將不再提供。另外MariaDB已經宣布了Cassandra存儲引擎的一個預覽版本。該插件允許MariaDB通過標準SQL語法使用Cassandra集群。

MariaDB跟MySQL在絕大多數方面是兼容的,對于開發者來說,幾乎感覺不到任何不同。目前MariaDB是發展最快的MySQL分支版本 。#p#

二 主要 Linux 發行版本安裝MariaDB

本文主要介紹兩大主要Linux 發行版本類別:

  • 使用rpm 軟件包格式的RHEL/CentOS/Fedora
  • 使用deb軟件包格式的Debian /Ubuntu 。

1、使用rpm 軟件包格式的RHEL/CentOS/Fedora

(1)這里以Fedora 19為例

其中使用Fedora 19 是最簡單的,因為這個***Linux 發行版本可以直接使用yum 軟件包工具安裝

a、安裝軟件包

  1. #yum -y install mariadb-server mariadb 
  2. #systemctl start mysqld.service 
  3. #systemctl enable mysqld.service 
  4. ln -s '/lib/systemd/system/mysqld.service' '/etc/systemd/system/multi-user.target.wants/mysqld.service' 

2、數據庫的基本操作

***連接MariaDB如圖4:

  1. #mysql -u root 

圖4***連接MariaDB

可以看到mariadb 版本號是5.5.31-MariaDB MariaDB Server,其他基本操作(和Mysql操作相同)。

查看用戶信息

使用內部命令:select user,host,password from mysql.user; 如圖5:

圖5查看用戶信息

設置root用戶密碼

  1. MariaDB [(none)]> set password for root@localhost=password('password'); 
  2. Query OK, 0 rows affected (0.00 sec) 
  3. # set root password 
  4. MariaDB [(none)]> set password for root@'127.0.0.1'=password('password'); 
  5. Query OK, 0 rows affected (0.00 sec) 

刪除一些數據庫用戶(ipv6 和 匿名用戶)

  1. MariaDB [(none)]> delete from mysql.user where user='root' and host='::1'
  2. Query OK, 1 rows affected (0.00 sec) 
  3. MariaDB [(none)]> delete from mysql.user where user=''
  4. Query OK, 2 rows affected (0.00 sec) 

退出后使用root密碼重新登錄

  1. #mysql -u root -p 
  2. Enter password: 
  3. # MariaDB root password you set 
  4. Welcome to the MariaDB monitor.  Commands end with ; or \g. 
  5. Your MariaDB connection id is 3 
  6. Server version: 5.5.31-MariaDB MariaDB Server 
  7. Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others. 
  8. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
  9. MariaDB [(none)]> 

#p#

3、安裝MariaDB客戶端工具

MariaDB的API和協議兼容MySQL,另外又添加了一些功能,以支持本地的非阻塞操作和進度報告。這意味著,所有使用MySQL的連接器、庫和應用程序也將會在MariaDB下工作。如下是支持MariaDB的工具客戶端:

  • DBEdit 一個免費的MariaDB數據庫和其他數據庫管理應用程序。
  • Navicat 一系列Windows、Mac OS X、Linux下專有數據庫管理應用程序。
  • HeidiSQL 一個Windows上自由和開放源碼的MySQL客戶端。它支持MariaDB的5.2.7版本和以后的版本。
  • phpMyAdmin 一個基于網絡的MySQL數據庫管理應用程序 。

下面介紹phpMyAdmin ,安裝使用phpMyAdmin要配置完成Apache 和 php 相關軟件包:

  1. # yum -y install httpd php php-mbstring php-pear 
  2. # yum -y install phpMyAdmin php-mysql php-mcrypt 

修改配置文件添加ip地址范圍:

  1. vi /etc/httpd/conf.d/phpMyAdmin.conf 
  2. # line 15: add IP address you permit 
  3. Require ip 127.0.0.1 10.0.0.0/24 
  4. # line 32: add IP address you permit 
  5. Require ip 127.0.0.1 10.0.0.0/24 
  6. #systemctl restart httpd.service 

然后使用瀏覽器訪問即可,如圖6:

圖6 phpMyAdmin管理mariadb數據庫

(2)其他使用rpm軟件包的發行版本

添加文件:/etc/yum.repos.d/MariaDB.repo

CentOS 6 64位發行版本的/etc/yum.repos.d/MariaDB.repo文件內容:

  1. [mariadb] 
  2. name = MariaDB 
  3. baseurl = http://yum.mariadb.org/5.5/centos6-amd64 
  4. gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB 
  5. gpgcheck=1 

安裝命令

  1. #yum -y install MariaDB-server MariaDB-client 
  2. # service mysql start 
  3. # chkconfig mysql on 

(3)其他版本安裝mariadb(以Ubuntu 12.04 為例子)

首先從 MariaDB 下載頁面 選擇貼近你的版本的資料庫鏡像,然后下載頁面會在底部顯示鏡像信息,將這些信息添加到 /etc/apt/source.list

  1. deb http://ftp.heanet.ie/mirrors/mariadb/repo/5.5/ubuntu lucid main 
  2. deb-src http://ftp.heanet.ie/mirrors/mariadb/repo/5.5/ubuntu lucid main 

2. 接下來需要導入簽名密鑰:

  1. # apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db 

3. 更新

  1. #apt-get update 

4. 安裝

  1. #apt-get install mariadb-server-5.5 

安裝過程中要輸入mariadb的root密碼并且確認一次如圖7:

圖7 輸入mariadb的root密碼并且確認一次

#p#

三 Mariadb的root密碼的重新設置

首先停止數據庫服務器進程:

  1. # service mysql stop 

安全模式啟動:

  1. # mysqld_safe --skip-grant-tables & 

登錄MariaDb server:

  1. # mysql -u root 
  2. Welcome to the MariaDB monitor. Commands end with ; or \g. 
  3. Your MariaDB connection id is 1 
  4. Server version: 5.5.32-MariaDB MariaDB Server 
  5. Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others. 
  6. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

設置密碼:

  1. MariaDB [(none)]> update mysql.user set password=PASSWORD("newpassword") where User='root'
  2. Query OK, 4 rows affected (0.00 sec) 
  3. Rows matched: 4 Changed: 4 Warnings: 0 

授權后退出:

  1. MariaDB [(none)]> flush privileges; 
  2. Query OK, 0 rows affected (0.00 sec) 
  3. MariaDB [(none)]> exit; 
  4. Bye 

重新啟動數據庫進程:

  1. # service mysql restart 

使用新密碼登錄:

  1. # mysql -u root -p 
  2. Enter password: 
  3. Welcome to the MariaDB monitor. Commands end with ; or \g. 
  4. Your MariaDB connection id is 1 
  5. Server version: 5.5.32-MariaDB MariaDB Server 
  6. Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others. 
  7. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

總結:

MariaDB 基本上名門之后,加上MySQL創始人Monty的實力和號召力,是作為MySQL一個非常好的替代品,前途發展無限,值得我們嘗試使用。二者的常用工具,連接程序都可以如常運作。你也不需要導出和匯入數據。格式與文件名都是相同的。

責任編輯:黃丹 來源: 51CTO.com
相關推薦

2020-12-18 09:15:16

LinuxVue命令

2024-01-10 14:24:32

Docker容器Kafka

2013-08-12 10:15:34

2021-12-10 11:30:58

Linux工具命令

2020-10-30 10:49:37

DockerGPULinux

2021-06-03 08:04:13

LinuxMySQL配置

2017-05-08 15:25:25

虛擬私有云公共云

2016-08-16 13:44:28

AndroidLinuxADT

2024-10-16 08:36:03

2010-10-15 13:45:20

安裝MySql數據庫

2021-08-25 12:55:33

Linuxcron

2010-07-09 09:37:32

2010-05-28 09:39:45

Linux系統Windows

2024-10-28 15:40:26

2011-09-29 10:03:02

2022-08-02 16:54:23

Kubernetes容器工具

2011-08-10 13:46:36

Navicat MySMySQL

2023-08-09 13:46:39

2010-07-09 13:07:58

Linux環境瀏覽器

2009-03-09 09:45:07

MVCAjax.Net
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 亚洲久久 | 精品国产一区探花在线观看 | av天天看| 国产成人综合一区二区三区 | 国产成人精品久久二区二区91 | 香蕉久久久 | 欧美精品成人 | 精品影院| 日本精品一区二区三区在线观看 | 神马久久春色视频 | 亚洲最新网址 | 日韩欧美一区二区三区免费观看 | av天天澡天天爽天天av | 超碰精品在线观看 | 国产japanhdxxxx麻豆 | 欧美日韩国产一区二区三区不卡 | 日韩av在线中文字幕 | 综合网在线 | 在线观看成人免费视频 | 日韩欧美在线观看一区 | 一二三四在线视频观看社区 | 日韩www| 亚洲免费视频在线观看 | 日本一区二区三区免费观看 | 亚洲欧美日韩精品久久亚洲区 | 国产精品免费高清 | 涩涩视频在线播放 | 亚洲欧美日本在线 | 日韩影院在线观看 | 夜色www国产精品资源站 | 国产农村妇女毛片精品久久麻豆 | 亚洲一二三区免费 | 日日操夜夜操天天操 | 国产精品免费一区二区三区四区 | 日本特黄特色aaa大片免费 | 欧美簧片| 精品国产91乱码一区二区三区 | 久久久久无码国产精品一区 | 天堂中文字幕av | 国产一伦一伦一伦 | 欧美精品一区二区在线观看 |