詳解Centos 使用YUM安裝MariaDB
1、在 /etc/yum.repos.d/ 下建立 MariaDB.repo,內(nèi)容如下:
[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
如果是其他的操作系統(tǒng),可以在這里找到相關(guān)信息。
2、使用YUM安裝MariaDB
[azureuser@mono yum.repos.d]$ sudo yum -y install MariaDB-client MariaDB-server MariaDB-devel
3、啟動(dòng)數(shù)據(jù)庫(kù)
[azureuser@mono yum.repos.d]$ sudo service mysql start
4、修改Root的密碼
[azureuser@mono yum.repos.d]$ mysqladmin -u root password ‘passwd'
5、配置遠(yuǎn)程訪問(wèn),MariaDB為了安全起見,默認(rèn)情況下綁定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;
第一句中"%"表示任何主機(jī)都可以遠(yuǎn)程登錄到該服務(wù)器上訪問(wèn)。如果要限制只有某臺(tái)機(jī)器可以訪問(wèn),將其換成相應(yīng)的IP即可,如:
GRANT ALL PRIVILEGES ON *.* TO root@"172.168.193.25" IDENTIFIED BY "root";
第二句表示從mysql數(shù)據(jù)庫(kù)的grant表中重新加載權(quán)限數(shù)據(jù)。因?yàn)镸ySQL把權(quán)限都放在了cache中,所以在做完更改后需要重新加載。
6、如果系統(tǒng)的防火墻開著(or behind a hardware firewall or NAT)你必須放開mysql使用的TCP端口,通常都是3306。
7、大小寫敏感
用root帳號(hào)登錄后,在/etc/my.cnf 中的[mysqld]后添加添加lower_case_table_names=1,重啟MYSQL服務(wù),這時(shí)已設(shè)置成功:不區(qū)分表名的大小寫;
lower_case_table_names參數(shù)詳解:
lower_case_table_names = 0
其中 0:區(qū)分大小寫,1:不區(qū)分大小寫
版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。
關(guān)注官方微信