mysqldump -uusername -ppassword -c -e –default-character-set=utf8 –single-transaction –skip-set-charset –add-drop-database -B dbname > dump.sql cp dump.sql dump-fixed.sql vim dump-fixed.sql :%s/DEFAULT CHARACTER SET latin1/DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci/ :%s/DEFAULT CHARSET=latin1/DEFAULT CHARSET=utf8/ :wq mysql -uusername -ppassword < dump-fixed.sql
Mysql
Converting an empty database to utf8
use the below command in Mysql ALTER DATABASE mydatabasename charset=utf8;
Repair all Mysql database at one go in Linux server
To repair all database at one go you need to run below commands,
mysqlcheck –all-databases -r #repair
mysqlcheck –all-databases -a #analyze
mysqlcheck –all-databases -o #optimize
Manager of pid-file quit without updating fi
Error “Manager of pid-file quit without updating fi”
If you get this error.
# ps -ef | grep mysql
# killall mysql
go to cd /var/lib/mysql/mysql
myisamchk -r *.MYI
Once done /etc/init.d/mysql restart
ERROR 1045 (28000): Access denied for user ‘root’@'localhost’
If you get this error you need to stop mysql first
/etc/init.d/mysql stop
Once done follow the below steps,
$ mysqld_safe –skip-grant-tables &
$ mysql -u root
$mysql> UPDATE user SET Password=PASSWORD(‘your password’) where USER=’root’;
$ /etc/init.d/mysql restart
Now $ mysql -u root -p
password: enter your new password here
Done you are in Mysql now
MySQL server has gone away (error 2006)
MySQL server has gone away (error 2006)
To resolve this issue you need to increase the wait_timeout in mysql configuration file
Set the below parameter in /etc/my.conf and restart Mysql
In /etc/my.cnf, set wait_timeout to at least 800 seconds
