We recently installed MySQL on an Ubuntu box for testing purposes. Setup was done by simply running the following as root.
sudo apt-get install mysql-server
Here’s what we did so we could connect remotely from a Windows 7 box.
1. Run mysql as root and grant root@% access.
# mysql -u root mysql> grant all on *.* to 'root'@'%' identified by password '';
Here we keep using the default root user with no password.
2. Edit my.cnf and allow MySQL to listen to all network interfaces (not just 127.0.0.1). Restart MySQL for the changes to take effect.
# sudo vi /etc/mysql/my.cnf bind-address = 0.0.0.0 # sudo service mysql restart
3. Once you can connect, we suggest you add the password. The command looks something like:
mysql> set password for 'root'@'%' = PASSWORD('secret');
We were doing a big database import in MySQL and we got this error message during the process.
Got a packet bigger than ‘max_allowed_packet’ bytes.
Here are the changes we needed to make it work. We are running on CentOS.
1. Edit /etc/my.cnf and add the following lines. The packet value we want for this example is 500M.
2. Restart MySQL.
> service mysqld restart
3. Run the MySQL import process with the max_allowed_packet parameter. Replace USERNAME, DATABASE and DUMP with the appropriate values.
> mysql --max_allowed_packet=500M -u USERNAME -p DATABASE < DUMP.sql
Wait for the import process to complete and that should be it.