Problems encountered during mysql usage

Source: Internet
Author: User

Problems encountered during mysql usage
Question 1:The first time mysql failed to start the service, no error message was returned.Solution: run the mysqld-console Command to view the error information. The solution is usually because the data folder in the mysql directory is incorrect. The solution is as follows. run the initialization command mysqld -- initalize before starting the service. download mysql 5.6 or earlier versions and copy the data folder in the compressed package to the root directory of the current mysql folder. Then, start the service, whether the first operation or the second operation, remember to turn off the service before the operation is complete and then open service Question 2:Mysql lacks the performance_schema.session system table, which causes various problems.Solution: run the following two commands to restart the Service (disable and enable it in windows) mysql_upgrade-u root-p -- force problem 3:When inserting data in mysql, an Error Code is returned in Chinese. Error Code: 1366. Incorrect string value.Solution: You need to complete the following steps. If the first step cannot be completed, you can skip the step and only affect the existing content in the database. However, to ensure that the new database and data table can be written in Chinese, the second step must be correct. 1. set the mysql encoding and change it to utf8 (because utf8 is a compatible encoding, you can change it to another encoding if you need to use other languages) to open the mysql root directory, create File my. ini then copies the content in the my-default.ini to my. ini then deletes the my-default.ini file, in my. in the [mysqld] section of the INI file, add the statement character_set_server = utf8, then close the mysql service and start the mysql service. After logging on to mysql, do not select any database. Run the \ s command to check the character set encoding and whether the server encoding is utf8, if yes, the remaining client And conn should be gbk by default. If not, you can search and set the database encoding method on the Internet, when I first connected to mysql, I actually chose the sys database (default system database). After the second step is completed, I chose other databases and then used the \ s command, you will find the difference. 2. after you set the database to utf8 encoding when creating a database, you will find that the DB character set encoding of the database you just created must be utf8, it also ensures that you can enter Chinese characters for the new database. The specific details are as follows: create database Name character set 'utf8'; 3. if the database encoding is not set and you still want to enter Chinese characters, you need to set the table encoding as follows when creating a data table and create multiple fields, use the character set 'utf8' code to change all fields in the TABLE to the utf8 format. create table Name (a large number of fields) character set 'utf8 '; the above steps should be completed whenever possible during mysql installation and configuration to avoid unnecessary troubles, or at least step 3 should be completed.

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.