MySQL manual installation and specific Chinese operations

Source: Internet
Author: User
Tags mysql manual

The following articles mainly introduce the actual installation methods of MySQL and specific Chinese solutions, the environment we demonstrated was to install MySQL (the best combination with PHP) 5.0.27 icc On Debian Etch Linux, and use JDBC to test Chinese!

The key to the Chinese problem is that all uses UTF-8 encoding, MySQL (the best combination with PHP) 5 release supports UTF-8, but the default is latin1, Java uses Unicode internally, therefore, ensure that the jsp (SUN Enterprise Application's preferred) page is coded in UTF-8, The JDBC driver uses the official Connector4J 5.0.4, in resin (a free JSP running platform) in the 3.1/Spring 2.0/Hibernate 3.2 Environment, Chinese characters are tested normally.

1. One of MySQL manual installation methods and Chinese solutions. Download "mysql()and php )))))-standard-5.0.27-linux-i686-icc-glibc23.tar.gz". The ICC version is recommended, which is said to be 10-20% better than GCC.

2. Copy to/usr/local/and decompress the file: tar zxvf mysql(and php ))))-standard-5.x...tar.gz

3. Add users and groups of MySQL (the best combination with PHP ):

Groupadd MySQL (best combination with PHP)

Useradd-g MySQL (the best combination with PHP)

4. Create a symbolic connection:/usr/local ln-s MySQL (best combination with PHP)-standard-5.x... MySQL (best combination with PHP)

5. cd MySQL (the best combination with PHP). Change the current directory to/usr/local/MySQL (the best combination with PHP )/

6. Run the script to initialize the database:./scripts/MySQL (the best combination with PHP) _ install_db -- user = MySQL (the best combination with PHP)

7. Set permissions:

/Usr/local/MySQL (the best combination with PHP) chown-R root.

/Usr/local/MySQL (the best combination with PHP) chown-R MySQL (the best combination with PHP) data

/Usr/local/MySQL (the best combination with PHP) chgrp-R MySQL (the best combination with PHP)

8. MySQL manual installation method and Chinese solution: Create and modify/etc/my. cnf as needed. Refer to the Configuration:

[MySQL (the best combination with PHP) d]

Set the default value to the INNODB table and support transactions:

 
 
  1. default-storage-engine=INNODB 

Set the default Character Set UTF-8:

 
 
  1. character-set-server=utf8 
  2. collation-server=utf8_general_ci 
  3. default-character-set=utf8 

Disable bdb:

Skip-bdb

9. Start MySQL (the best combination with PHP ):

/Usr/local/MySQL (the best combination with PHP)/bin. /MySQL (the best combination with PHP) d_safe -- user = MySQL (the best combination with PHP )&

10. initialize the root password:

/Usr/local/MySQL (the best combination with PHP)/bin. /MySQL (the best combination with PHP) admin-u root-p password "password-of-root"

Enter password: <Enter the old password and press Enter>

11. log on to the root account to create a database:

/Usr/local/MySQL (the best combination with PHP)./MySQL (the best combination with PHP)-u root-p

Enter password: password-of-root

12. Create a new user:

 
 
  1. MySQL (best combination with PHP)> create user test identified by 'test-password ';

13. Create a new database:

 
 
  1. MySQL (best combination with PHP)> create database testdb default character set utf8 default collate utf8_general_ci;

Baidu I post it Sina Weibo must specify the character set and sorting method, are UTF-8, so as to ensure that the creation of the table also use UTF-8.

14. Grant the test user the permission to access testdb from localhost and use the password:

 
 
  1. MySQL (best combination with PHP)> grant all on testdb. * to test @ localhost identified by 'test-password ';

Note: to remotely connect to MySQL using JDBC (the best combination of PHP and MySQL), you must set the test user permission correctly. MySQL (the best combination of MySQL and PHP) the access permission is composed of the user name, client machine name, and password. The preceding example indicates that only the test user is allowed to connect to MySQL (the best combination with PHP) on the local machine (localhost ).

15. MySQL manual installation method and Chinese solution: Stop the MySQL (the best combination with PHP) server:

 
 
  1. /Usr/local/MySQL (the best combination with PHP)/bin #./MySQL (the best combination with PHP) admin-u root-p shutdown
  2. Enter password: password-of-root
  3. STOPPING server from pid file/usr/local/MySQL (best combination with PHP)/data/debian. pid
  4. Xxx MySQL (best combination with PHP) d ended

Chinese cheats:

All encoding-related settings in/etc/my. cnf should be set to UTF-8, refer to Step 8.

Perform the following steps:

 
 
  1. MySQL (the best combination with PHP)> status;

Note that the characterset values must be UTF-8. Otherwise, modify/etc/my. cnf. Refer to Step 8.

 
 
  1. MySQL (best combination with PHP)> show variables like '% char % ';

Except character_set_filesystem is displayed as binary, all others should be displayed as utf8. If not, modify/etc/my. cnf. Refer to Step 8.

 
 
  1. MySQL (best combination with PHP)> show variables like '% collation % ';

The display should all be utf8_general_ci. Otherwise, modify/etc/my. cnf. Refer to Step 8.

 
 
  1. MySQL (best combination with PHP) show-u root-p-I database-name

Role: show the database details, if you do not see utf8_general_ci, but latin_swedish_ci, indicating that the database code is not UTF-8, Chinese is certainly not normal, delete it, and then refer to Step 13 to re-create a database with a UTF-8.

The above content is an introduction to the MySQL manual installation method and Chinese solutions. I hope you will have some gains.

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.