您好,登錄后才能下訂單哦!
Mysql 5.5中怎么設(shè)置數(shù)據(jù)庫參數(shù),針對這個(gè)問題,這篇文章詳細(xì)介紹了相對應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問題的小伙伴找到更簡單易行的方法。
--全局級別
mysql> show global variables like '%server%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| character_set_server | utf8 |
| collation_server | utf8_general_ci |
| server_id | 1 |
+----------------------+-----------------+
3 rows in set (0.00 sec)
mysql> set global character_set_server=gbk;
Query OK, 0 rows affected (0.10 sec)
mysql> show global variables like '%server%';
+----------------------+----------------+
| Variable_name | Value |
+----------------------+----------------+
| character_set_server | gbk |
| collation_server | gbk_chinese_ci |
| server_id | 1 |
+----------------------+----------------+
3 rows in set (0.01 sec)
也可以使用下面方式來修改
mysql> show global variables like 'character_set_server';
+----------------------+--------+
| Variable_name | Value |
+----------------------+--------+
| character_set_server | latin1 |
+----------------------+--------+
1 row in set (0.00 sec)
mysql> set @@global.character_set_server=gbk;
Query OK, 0 rows affected (0.00 sec)
mysql> show global variables like 'character_set_server';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| character_set_server | gbk |
+----------------------+-------+
1 row in set (0.01 sec)
--會(huì)話級別
mysql> set session character_set_server='utf8';
Query OK, 0 rows affected (0.00 sec)
mysql> show global variables like '%server%';
+----------------------+----------------+
| Variable_name | Value |
+----------------------+----------------+
| character_set_server | gbk |
| collation_server | gbk_chinese_ci |
| server_id | 1 |
+----------------------+----------------+
3 rows in set (0.00 sec)
--show variables查詢的是會(huì)話級別的參數(shù)
mysql> show variables like '%server%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| character_set_server | utf8 |
| collation_server | utf8_general_ci |
| server_id | 1 |
+----------------------+-----------------+
3 rows in set (0.00 sec)
mysql> show session variables like '%server%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| character_set_server | utf8 |
| collation_server | utf8_general_ci |
| server_id | 1 |
+----------------------+-----------------+
3 rows in set (0.00 sec)
即使是使用set global命令設(shè)置的參數(shù),在數(shù)據(jù)庫重啟后,相關(guān)的參數(shù)也會(huì)失效;如果想讓參數(shù)永久生效,可以將參數(shù)寫在配置文件里面。
[root@localhost mysql]# vim /etc/my.cnf
# Character set
character_set_server = gbk
collation_server = gbk_bin
關(guān)于Mysql 5.5中怎么設(shè)置數(shù)據(jù)庫參數(shù)問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注億速云行業(yè)資訊頻道了解更多相關(guān)知識。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。