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