Centos系統中YUM安裝MariaDB資料庫教程

來源:互聯網
上載者:User


1、在 /etc/yum.repos.d/ 下建立 MariaDB.repo,內容如下:
[azureuser@mono etc]$ cd /etc/yum.repos.d
[azureuser@mono yum.repos.d]$ vi MariaDB.repo

# MariaDB 10.0 CentOS repository list – created 2013-08-23 13:08 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

如果是其他的作業系統,可以在這裡找到相關資訊。

2、使用YUM安裝MariaDB
[azureuser@mono yum.repos.d]$ sudo yum -y install MariaDB-client MariaDB-server MariaDB-devel

3、啟動資料庫
[azureuser@mono yum.repos.d]$ sudo service mysql start

4、修改Root的密碼

[azureuser@mono yum.repos.d]$ mysqladmin -u root password ‘passwd’

5、配置遠端存取,MariaDB為了安全起見,預設情況下綁定ip( 127.0.0.1)。

[azureuser@mono yum.repos.d]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.0.4-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]>GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘passwd’ WITH GRANT OPTION;

MariaDB [(none)]> flush privileges;

第一句中”%”表示任何主機都可以遠程登入到該伺服器上訪問。如果要限制只有某台機器可以訪問,將其換成相應的IP即可,如:

GRANT ALL PRIVILEGES ON *.* TO root@”172.168.193.25″ IDENTIFIED BY “root”;

第二句表示從mysql資料庫的grant表中重新載入許可權資料。因為MySQL把許可權都放在了cache中,所以在做完更改後需要重新載入。

6、如果系統的防火牆開著(or behind a hardware firewall or NAT)你必須放開mysql使用的TCP連接埠,通常都是3306。

7、大小寫敏感

用root帳號登入後,在/etc/my.cnf 中的[mysqld]後添加添加lower_case_table_names=1,重啟MYSQL服務,這時已設定成功:不區分表名的大小寫;
lower_case_table_names參數詳解:
lower_case_table_names = 0
其中 0:區分大小寫,1:不區分大小寫
 

OSX 上安裝 MariaDB

http://www.foolegg.com/how-to-setup-a-nginx-mariadb-php-mnmp-server-on-mac-osx/

https://kb.askmonty.org/en/building-mariadb-on-mac-os-x-using-homebrew/

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.