Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set database parameters in Mysql 5.5

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

How to set database parameters in Mysql 5.5. in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

-- Global level

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.01sec)

You can also modify it in the following ways

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)

-- session level

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 queries session-level parameters

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)

Even the parameters set using the set global command will be invalidated after the database restart; if you want the parameters to take effect permanently, you can write the parameters in the configuration file.

[root@localhost mysql] # vim / etc/my.cnf

# Character set

Character_set_server = gbk

Collation_server = gbk_bin

This is the answer to the question about how to set the database parameters in Mysql 5.5. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report