Linux涔婱ariaDB

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux涔婱ariaDB相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/%e5%bc%80%e6%ba%90%e7%a4%be%e5%8c%ba' title='寮€婧愮ぞ鍖?>寮€婧愮ぞ鍖?/a>   cti   yum   charset   error   绠$悊   ble   璧锋簮   鍘熷洜   

MariaDB鏁版嵁搴撶殑璧锋簮

MariaDB鏁版嵁搴撶鐞嗙郴缁熸槸MySQL鐨勪竴涓垎鏀紝涓昏鐢卞紑婧愮ぞ鍖哄湪缁存姢锛岄噰鐢℅PL鎺堟潈璁稿彲銆?br>寮€鍙戣繖涓垎鏀殑鍘熷洜涔嬩竴鏄細鐢查鏂囧叕鍙告敹璐簡MySQL鍚庯紝鏈夊皢MySQL闂簮鐨勬綔鍦ㄩ闄╋紝鍥犳绀惧尯閲囩敤鍒嗘敮鐨勬柟寮忔潵閬垮紑杩欎釜椋庨櫓銆?br>MariaDB鐨勭洰鐨勬槸瀹屽叏鍏煎MySQL锛屽寘鎷珹PI鍜屽懡浠よ锛屼娇涔嬭兘杞绘澗鎴愪负MySQL鐨勪唬鏇垮搧銆?/h4>

Red Hat Enterprise Linux/CentOS 7.0 鍙戣鐗堝凡灏嗛粯璁ょ殑鏁版嵁搴撲粠 MySQL 鍒囨崲鍒?MariaDB銆?/h4>

 

1.閰嶇疆MariaDB瀹樻柟yum婧?/h2>

娣诲姞 MariaDB yum 浠撳簱

棣栧厛娣诲姞 MariaDB 鐨?yum婧?閰嶇疆鏂囦欢 MariaDB.repo 鏂囦欢銆?
1. 缂栬緫鍒涘缓mariadb.repo浠撳簱鏂囦欢
vi /etc/yum.repos.d/MariaDB.repo

2. 娣诲姞repo浠撳簱閰嶇疆
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

 

2.鍦–entos7涓婂畨瑁呭苟鍚姩MariaDB

1.瀹夎
褰?MariaDB 浠撳簱鍦板潃娣诲姞濂藉悗锛屼綘鍙互閫氳繃涓嬮潰鐨勪竴琛屽懡浠よ交鏉惧畨瑁?MariaDB銆? yum install MariaDB
-server MariaDB-client -y

2.鍚姩
鍦╟entos涓搷浣渕ariadb鏁版嵁搴撶殑鐩稿叧鍛戒护鏄細

systemctl start mariadb  #鍚姩MariaDB

systemctl stop mariadb  #鍋滄MariaDB

systemctl restart mariadb  #閲嶅惎MariaDB

systemctl enable mariadb  #璁剧疆寮€鏈哄惎鍔?/pre>

 

3. 鍒濆鍖朚ariaDB

鍦ㄧ‘淇滿ariaDB姝g‘杩愯鍚庢墽琛屼笅闈㈠懡浠よ繘琛屽垵濮嬪寲

mysql_secure_installation

杩欐潯鍛戒护鎵ц浠ュ悗浼氬嚭鐜颁竴涓氦浜掗〉闈? 鎻愮ず浣犺緭鍏ユ垨纭畾鏌愪簺浜嬫儏

? 璁剧疆 root 绠$悊鍛樺湪鏁版嵁搴撲腑鐨勫瘑鐮佸€?娉ㄦ剰锛岃瀵嗙爜骞堕潪 root 绠$悊鍛樺湪绯荤粺涓殑瀵嗙爜锛岃繖閲岀殑瀵嗙爜鍊奸粯璁ゅ簲璇ヤ负绌猴紝鍙洿鎺ユ寜鍥炶溅閿?銆?? 璁剧疆 root 绠$悊鍛樺湪鏁版嵁搴撲腑鐨勪笓鏈夊瘑鐮併€?? 鏄惁鍒犻櫎鍒犻櫎鍖垮悕璐︽埛锛?br>
? 鏄惁鍙互浣跨敤 root 绠$悊鍛樹粠杩滅▼鐧诲綍鏁版嵁搴擄紝浠ョ‘淇濇暟鎹簱涓婅繍琛岀殑涓氬姟鐨勫畨鍏ㄦ€с€?
? 鏄惁鍒犻櫎榛樿鐨勬祴璇曟暟鎹簱锛屽彇娑堟祴璇曟暟鎹簱鐨勪竴绯诲垪璁块棶鏉冮檺銆?
? 鏄惁鍒锋柊鎺堟潈鍒楄〃锛岃鍒濆鍖栫殑璁惧畾绔嬪嵆鐢熸晥銆?/span>

 

4. MariaDB鏁版嵁搴撶殑缂栫爜璁剧疆

缂栫爜鏍煎紡鏄拡瀵筪atabase鏉ヨ鐨? 鍙互鏇存敼鏌愪釜database鐨勭紪鐮佹牸寮?/p>

alter database db1 charset gbk;

杩樺彲浠ユ煡鐪嬫煇涓猟atabase鍦ㄥ垱寤烘椂浣跨敤鐨勭紪鐮佹牸寮?/p>

MariaDB [(none)]> show create database db02;
+----------+---------------------------------------------------------------+
| Database | Create Database                                               |
+----------+---------------------------------------------------------------+
| db02     | CREATE DATABASE `db02` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+---------------------------------------------------------------+
1 row in set (0.00 sec)

 

鍦ㄩ厤缃枃浠朵腑鎸囧畾缂栫爜鏍煎紡鍗冲彲, 鏈夌殑涓嶉渶瑕侀噸澶嶉厤缃? 涓昏鏄拰character鐩稿叧鐨勯厤缃」

vim /etc/my.cnf

[mysqld] character
-set-server=utf8 collation-server=utf8_general_ci log-error=/var/log/mysqld.log server-id=1 log-bin=mysqls14-bin [client] default-character-set=utf8 [mysql] default-character-set=utf8

鍦ㄦ暟鎹簱涓煡鐪嬮粯璁ょ殑缂栫爜鏍煎紡

MariaDB [(none)]> s銆€銆€# 鏌ョ湅缂栫爜鐨勫懡浠? 鐩稿綋浜巗tatus
--------------
mysql  Ver 15.1 Distrib 10.1.37-MariaDB, for Linux (x86_64) using readline 5.1

Connection id:        13
Current database:    
Current user:        [email protected]
SSL:            Not in use
Current pager:        stdout
Using outfile:        鈥樷€?/span>
Using delimiter:    ;
Server:            MariaDB
Server version:        10.1.37-MariaDB MariaDB Server
Protocol version:    10
Connection:        Localhost via UNIX socket
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:        /var/lib/mysql/mysql.sock
Uptime:            1 hour 1 min 47 sec

Threads: 3  Questions: 465  Slow queries: 0  Opens: 66  Flush tables: 1  Open tables: 60  Queries per second avg: 0.125
--------------

 

4. MariaDB鏁版嵁搴撶殑甯哥敤鎿嶄綔

MariaDB鏁版嵁搴撶殑鎿嶄綔鍜宮ysql鏄竴鏍风殑

 

5. MariaDB鏁版嵁搴撳浠藉拰鎭㈠澶囦唤

 

以上是关于Linux涔婱ariaDB的主要内容,如果未能解决你的问题,请参考以下文章

Django涔婱odel鎿嶄綔

[linux][c/c++]代码片段01

[linux][c/c++]代码片段02

linux打开终端如何启动scala,如何在终端下运行Scala代码片段?

Android 逆向Linux 文件权限 ( Linux 权限简介 | 系统权限 | 用户权限 | 匿名用户权限 | 读 | 写 | 执行 | 更改组 | 更改用户 | 粘滞 )(代码片段

linux中怎么查看mysql数据库版本