MySQL configuration command character_set_% character set settings

Source: Internet
Author: User
Tags mysql insert administrator password

Reference: http://blog.csdn.net/mzlqh/article/details/7621307 Click to open linkin fact, now the UBUNTU12.GenevaDirect sudo apt-GetInstall MySQL on the go, mysql-.The client will automatically load you # to see if MySQL is running sudo netstat-tap |grep MySQL If it is running, then the TCP0 0Localhost.localdomain:mysql *:* LISTEN-Restart Mysqlsudo/etc/init.d/MySQL Restart Configure the administrator password for MySQL:1sudo mysqladmin-u root password newpassword Third, MySQL service to join the boot from start-up: sudo update-rc.d mysql defaults removed from boot: sudo update-RC.D-f MySQL Remove quad, remotely connect Ubuntu under Mysqlvim/etc/mysql/my.cnf Find bind-address =127.0.0.1this line, comment out (see below) #bind-address =127.0.0.1or instead of bind .-address =0.0.0.0allow any IP access, or specify an IP address yourself. Then restart Mysqlsudo/etc/init.d/MySQL Restart authorized users can connect remotely grant all privileges on*. * to Root@"%"Identified by"Password"with Grant Option;flush privileges; The first line of the command is explained below,*. *: The first * represents the database name; the second * represents the table name. This means that all tables in the database are licensed to the user. Root: Grant root account. “%": Indicates that the authorized user IP can be specified, which means that any IP address can access the MySQL database. "Password": Assign the password of the account, here the password itself is replaced with your MySQL root account password. The second line of command is to refresh the permission information, that is, let our settings take effect immediately. Now the remote connection to the Ubuntu under the MySQL should be able to connect. Troubleshoot MySQL insert Chinese characters when garbled [SQL] view plain copy print? onFor example, you can set the default encoding to UTF8 when building a library: Geneva. Create DATABASE MyDBdefaultCharacterSetUTF8 collate utf8_general_ci; [SQL] View plain copy print? onThe problem is resolved because the following code is missing from the MY.CNF: Geneva. [Client]Geneva.default-character-Set=UTF8Geneva. [Mysqld] to.default-character-Set=UTF8 ..  -.  ,If you do not add the above code, even if the encoding specified at MySQL compile installation is UTF8, the default encoding for the library is still LATIN1, and the table in the library is LATIN1 due to the inheritance of the character set.  the. Ten.  OneHere are a few commands that you can try on your own:12.1. Lists all the character sets supported by MySQL: -.  SHOW CHARACTER SET;  -. 15.2. Current MySQL server character set settings -. SHOW VARIABLES like'character_set_%';  -. 18.3. Current MySQL server character set checksum settings +. SHOW VARIABLES like'collation_%';  -. 21.4. Display a database character set setting A. Show create database name;  at. 24.5. Display a data table character set -. Show create table table name;  -. 27.6. Modifying the database character set -. ALTER DATABASE namedefaultCharacterSet 'UTF8';  in. 30.7. Modifying the data table character set to. ALTER TABLE namedefaultCharacterSet 'UTF8';  +. 33.8. Specifying a character set when building a library the. Create DATABASE name characterSetGBK collate gbk_chinese_ci;  *. 36.9. Specifying a character set when building a tablePanax Notoginseng. CREATE TABLE ' Mysqlcode ' ( -. ' ID ' TINYINT (255) UNSIGNED not NULL auto_increment PRIMARY KEY, the. ' Content ' VARCHAR (255) Not NULL +.) TYPE =MYISAM CHARACTER SET gbk COLLATE gbk_chinese_ci; Ubuntu12.GenevaMySQL configuration file path is/etc/mysql/my.cof [SQL] View plain copy print? on. (2) with the command show variables like'character\_set\_%'; View current character Set settings: [SQL] View plain copy print? on. Modify MySQL character encoding appears job failed to start solution Geneva. Genevawhen populating the MySQL database under the Python mange.py shell, I find that Chinese characters cannot be entered. GenevaThe MySQL database encoding is then modified.  to.  .The following information is found on the Internet: -. $sudo gedit/etc/mysql/my.cnf ,. Add under [client]: the. Ten.default-character-Set=UTF8 One.  A. [Mysqld] under Add: -.  -.default-character-Set=UTF8 the.  -. And then save the exit -.  -. $sudo service MySQL Restart +.  -. The result appears job failed to start +. Www.2cto.com A.-------------------------------------------------------------------------------------------------------------- -------------- atmay be a version of the problem, check the version of 5.5 after the method of character encoding modification, found that [mysqld] modification methods changed: -.  -. [mysqld] should be added below: -.  -. character-Set-server=UTF8 -.  in. collation-server=Utf8_general_ci -.  to. Save Exit +.  -. $sudo service MySQL Restart the.  *. Success $. Panax Notoginseng. Enter the MySQL console: -.  the. Show variables like'character%';  +. Www.2cto.com A.+-----------------------------------+-----------------------------------+ the.| variable_name | Value | +.  -.+-----------------------------------+-----------------------------------+ $.  $.| character_set_client | UTF8 | -.  -.| character_set_connection | UTF8 | the.  -.| Character_set_database | UTF8 |Wuyi.  the.| Character_set_filesystem | binary | -.  Wu.| Character_set_results | UTF8 | -. Www.2cto.com About.| Character_set_server | UTF8 | $.  -.| Character_set_system | UTF8 | -.  -.| Character_sets_dir | /usr/share/mysql/charsets/| A.  +.+------------------------------------+-----------------------------------+ the. 64.8Rowsinch Set(0.00sec) $.  the. has been modified successfully, make the next record.  the.  the. Finally, this is done: [SQL] View plain copy print? on. $sudo gedit/etc/mysql/my.cnf Geneva. Add under [client]:Geneva. Geneva.default-character-Set=UTF8 to. [mysqld] should be added below: ..  -. character-Set-server=UTF8 ,.  the. collation-server=Utf8_general_ciTen.  One. Save Exit A.  -. $sudo service MySQL Restart -.  the. Successful but the way to solve the Chinese garbled is not over. [SQL] View plain copy print? onthe default character set for the. Character_set_server server.  Geneva. Character_set_database the character set used by the default database. When the default database changes, the server sets the variable.  If there is no default database, the value of the variable is the same as character_set_server. Geneva. Show variables like'character%'; Geneva. You use SET @ @character_set_database =UTF8 to. Show variables like'character%';  .. I'm looking at the value of Character_set_server .!

MySQL configuration command character_set_% character set settings

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.