1. 程式人生 > >Centos 使用YUM安裝MariaDB

Centos 使用YUM安裝MariaDB

http://www.cnblogs.com/shanyou/p/3278692.html

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

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

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

3、啟動資料庫 
[[email protected] yum.repos.d]$ sudo service mysql start 

4、修改Root的密碼

[[email protected] yum.repos.d]$ mysqladmin -u root password ‘passwd’

5、配置遠端訪問,MariaDB為了安全起見,預設情況下繫結ip( 127.0.0.1)。

[[email protected] 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 [email protected]"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

相關文章 :