How to install and uninstall mysql in linux
Install mysql
1. yum list | grep mysql // view the downloadable mysql database version provided on yum
2. yum install-y mysql-server mysql-devel // yum install mysql
3. service mysqld start // start mysql
4. mysqladmin-u root password '200' // set the User password
5. Set mysql users
Mysql> use mysql;
Mysql> update user set password = password ('000000') where user = 'root' and host = 'localhost ';
Mysql> flush privileges;
6. chkconfig mysqld on // set startup
7. chkconfig -- list | grep mysql // view the startup status
8. grant all privileges on *. * TO root @ '%' identified by '000000' with grant option; // allow remote connection
Uninstall mysql
1. Uninstall the program
Rpm-qa | grep-I mysql // view installed mysql
Rpm-ev MySQL-client-5.5.25a-1.rhel5 // uninstall to view results in the list
Rpm-ev MySQL-client-5.5.25a-1.rhel5 -- nodeps // use the force uninstall command if an error is reported
Rpm-e -- noscripts MySQL-client-5.5.25a-1.rhel5 // if an error is returned, try this command
2. Find a directory and delete all files under the Directory
Find/-name mysql // find all mysql-Related Files
Rm-rf/var/lib/mysql // remove the files in the search results one by one
3. Delete the configuration file
Rm-rf/etc/my. cnf // Delete the configuration file that is not in the list above
4. Check whether the uninstallation is complete
Find/-name mysql
Rpm-qa | grep-I mysql
If they are empty, the operation is complete.