1.redhat Yum Replacement Reference
url:http://blog.csdn.net/zcyhappy1314/article/details/17580943
2.yum uninstalling MySQL
Rpm-qa|grep-i MySQL
Yum remove MySQL mysql-server mysql-libs;
Or
Rpm-ev mysql-server-4.0.14-0 mysql-client-4.0.14-0
Data and/ETC/MY.CNF in/var/lib/mysql will not be removed after uninstallation, and will be removed manually if determined to be useless.
Rm-f/etc/my.cnf
Rm-rf/var/lib/mysql
3.yum installing MySQL
[Root@sample ~]# yum-y install mysql-server← installing MySQL
Reference url:http://evanlinux.blog.51cto.com/7247558/1374023
4. Configure MySQL
[Root@sample ~] #vim/etc/my.cnf← Edit the MySQL configuration file
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
User=mysql
# Disabling Symbolic-links is recommended to prevent assorted security risks
Symbolic-links=0
Old_passwords=1
default-character-set=utf8← Add this line
5. View Port 3306
lsof-i:3306
6. Firewall Open Port 3306
Vim/etc/sysconfig/iptables
Add a row
-A input-p tcp-m tcp--dport 3306-j ACCEPT
Make it effective
Service Iptables Restart
/etc/rc.d/init.d/iptables Save
7. Start MySQL
[[email protected] ~]#/etc/rc.d/init.d/mysqld start← start MySQL service
Or
[[Email protected] ~]# service mysqld start
8. Allow MySQL extranet access
Use MySQL;
Select Host,user from user;
Update user set host= '% ' where user= ' root ' and host= ' localhost ';
Flush privileges;
This time you can use the graphical management tool to access the ....
9. You may encounter this error later
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)
Do these things:
Service Mysqld Stop
Mysqld_safe--skip-grant-tables--skip-networking &
Use MySQL;
Select Host,user,password from user;
Delete from user where host!= '% '
10. Set the root password
When MySQL was first installed, its root user was not set to the password. Start by setting up the root password for MySQL.
[[email protected] ~]# mysql-u root← Log in to the MySQL server with the root user
mysql> UPDATE user SET Password=password (' 963852 ') where user= ' root ' and host= '% ';
Or
Mysql>grant all on mysql.* to ' root ' @ ' localhost ' identified by ' password ';
Or
mysql> set password for ' root ' @ ' localhost ' =password (' 123456 ');
You can then log in to MySQL via a password.
11. Permission settings
Any host that connects to the MySQL server with user root and password mypwd all the tables in all databases for all operations
Mysql> GRANT All privileges on * * to ' root ' @ '% ' identified by ' 963852 ' with GRANT OPTION;
mysql> flush Privileges;
MySQL installation and basic configuration-redhat