MYSQL Problem Small Summary

Source: Internet
Author: User

MySQL Problem small Summary


1.MySQL Remote Connection Error 2003 (HY000): Can ' t connect to MySQL server on ' IP ' (111) issue

Typically, the MySQL configuration file is configured with the
/etc/mysql/my.cnf
[Mysqld]
bind_address=127.0.0.1
In this case, only the local computer can connect to TCP/IP
Add # Comment out or change to 0.0.0.0

2. Database Import and Export
Export the entire library
Mysqldump-u dbadmin-p myblog >/home/zhangy/blog/database_bak/myblog.sql
Export a table
Mysqldump-u dbadmin-p MyBlog wp_users>/home/zhangy/blog/database_bak/blog_users.sql

3. Export a database structure
Mysqldump-u Dbadmin-p-D--add-drop-table myblog >/home/zhangy/blog/database_bak/blog_struc.sql
Description:-D has no data--add-drop-table add a drop table before each CREATE statement

4. Export the database a table structure
Mysqldump-u Dbadmin-p-D--add-drop-table myblog wp_users>/home/zhangy/blog/database_bak/blog_users_struc.sql
Description:-D has no data--add-drop-table add a drop table before each CREATE statement

Import of databases
1, the file backed up with Mysqldump is a SQL script that can be poured directly, there are two ways to import data.
For example:
#/usr/local/mysql/bin/mysql-u root-p * * * * * MyBlog

This way, I used to be very rarely used now, because it is easy to produce garbled, because:

A, when you export the database, if you forget to set the export character sets, when the import, there may be problems.

b, if you set the export setting when the UTF8 encoding, but you have your database now the character set is changed to gb2312. This will be garbled.

2, using the source statement
For example:

Mysql-u dbadmin-p

Use MyBlog;

Set names UTF8; #这里的字符集根你的将要导入的数据库的字符集一至.

Source/home/zhangy/blog/database_bak/myblog.sql;

Remote Connection Database

Mysql-h Ip-u-P

Start Mysqlworkbench Mysql-workbench

Start MySQL service MySQL start

Stop MySQL service MySQL stop

Restart MySQL service MySQL restart

MYSQL Problem Small Summary

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.