Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Linux Ask!

Feb 202011
 

Create MySQL Dump that ignore duplicate key error when import back to MySQL

Answer:

When you import a dump file created by the mysqldump command, to a non-empty database, duplicate key error such as "Duplicate entry 'X' for key 'Y'" might occur.

To ignore this error, simply use the following command:

# mysqldump my_db my_table --insert-ignore
Feb 182011
 

SIOCSIFADDR: No such device after cloning VM

Answer:

When you cloned a VM from another machine, or migrated from another VM solution such as Xen, when you start the networking, you might encounter the problem of "SIOCSIFADDR: No such device eth0".

This is because the MAC address of your VM has changed!

To solve it, just enter the command below:

# sudo rm /etc/udev/rules.d/70-persistent-net.rules

Restart your VM and should be okay now.

Feb 122011
 

Solving the error "Packet too large" in MySQL

Answer:

When you try to insert a very large row of data (e.g. BLOB) into MySQL using a single insert statement, MySQL might give you the error "Packet too large". You might need to adjust the value of max_allowed_packet as needed.

1. Edit the MySQL configurations, e.g. /etc/my.cnf

..
max_allowed_packet=32M
..

Don't forget to restart MySQL to take effect.

# /sbin/service mysqld restart

Reference: http://dev.mysql.com/doc/refman/5.5/en/packet-too-large.html