In Linux, if I use the mysql graphics client, I feel that Emma is a good tool. It is better than mysql MysqlQueryBrowser, and the most intolerable thing is that MysqlQueryBrowser will crash in Ubuntu11.10. Emma is quite good, but emma is installed with apt-get by default, and emma does not support Chinese. You need to modify the configuration file or modify emma directly.
In Linux, if I use the mysql graphics client, I feel that Emma is a good tool.
It is better than mysql's own Mysql Query Browser, and the most intolerable thing is that Mysql Query Browser will crash in Ubuntu 11.10.
Emma is quite good, but emma is installed with apt-get by default, and emma does not support Chinese. You need to modify the configuration file by yourself, or directly modify the emma program source file (emma is written in python ).
Install emma with apt-get
- Sudo apt-get install emma
If you have installed emma and run emma, the program will be created ~ /. Emma/emmarc file to save some of your configurations. Therefore, you can change the configuration file or directly modify the python source file of emma as follows.
- Vim ~ /. Emma/emmarc
Find
- Db_encoding = latin1
Change
- Db_encoding = utf8
Then, run emma again, and the code is still garbled. Don't worry, add this SQL statement before executing all the SQL statements,
- SetNames utf8
Press ctrl + enter to run the command, and then check whether it is OK. Chinese characters are displayed normally. (The premise is that your database is UTF-8 encoded)
Okay, but it is not very laborious for new users to modify the configuration file and add this statement before executing the new SQL statement. I am very lazy, and most of my databases are utf8, So I directly modify the emma source file to implement it. The newly created emmrc configuration file is utf8, And when I select a database, automatically execute the "set names utf8" statement.
Install emma in apt-get of ubuntu under the/usr/share/emma directory.
- Cd/usr/share/emma/emmalib
- Sudo vim _ init _. py
Find
- "Db_encoding": "latin1"
Change
- "Db_encoding": "utf8"
Save and exit. In the future, the new configuration file will be decoded by utf8 by default. I want to execute the "set names utf8" statement after the data is connected.
- Sudo vim/usr/share/emma/emmalib/mysql_host.py
Jump to the _ use_db (self, name, do_query = True) Function Around 155 rows and change it to the following:
- Def_ Use_db (Self, Name, do_query =True):
- If Self. Current_dbAndName =Self. Current_db.name:Return
- IfDo_query:
- Self. Query ("Use '% S '"% Name,False)
- Self. Query ("Set names utf8",False)
- Try:
- Self. Current_db =Self. Databases [name]
- ExceptKeyError:
- Print "Warning: used an unknown database % r! Please refresh host! \ N % s"% (Name, "". join (traceback. format_stack ()))
You can change it to the preceding format. Pay attention to spaces because python uses the space-based statement segmentation syntax.
In fact, I added a sentence.
- Self. Query ("Set names utf8",False)
This is the complete OK.
Reference: http://www.linuxidc.com/Linux/2011-11/47168.htm