Mysql Issues

/var/lib/mysql –> mysql engine operates 

 

Backup of Mysql
mysqldump ‘database name’ > mysql.sql 
mysqldump -u ‘username’ –database ‘db_name’ > database.sql -p 

To restore dump file
mysql ‘database name’ < mysql.sql 
mysql -u ‘username’ –database ‘db_name’ < database.sql -p 

To repair Mysql
/var/lib/mysql/database myisamcheck -r -s *.MYI

 

To check the mysql error logs

tail -f /var/lib/mysql/`hostname`.err

 

To check a database is working
mysql -u –database -p 

 

To change the password of a database

grant all on .* to @localhost identified by ‘password’;

 

To change the password of an user in a table of database

For example:

To change the password of admin. 
login to mysql 
use database; 
show tables; 
# UPDATE SET password=md5(‘t0pher74’) where username=admin

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s