卸载系统自带的版本。
这里以MySQL-5.5.28-1为版本
为了简单,RPM方式安装:
rpm -ivh MySQL-server-5.5.28-1.linux2.6.x86_64.rpm
rpm -ivh MySQL-client-5.5.28-1.linux2.6.x86_64.rpm
#mysql
mysql>update mysql.user set password="chengshan" where user="root";//
mysql>delete from mysql.user where user='';//删除匿名用户
mysql>select user,host from mysql.user;
mysql>delete from mysql.user where host='127.0.0.1';
mysql>delete from mysql.user where host='localhost';
mysql>create user 'zcs'@'127.0.0.1' identified by 'chengshan';
mysql>grant all privileges on *.* to 'root'@'%' identified by 'chengshan' with grant option;
mysql>grant all privileges on *.* to 'zcs'@'%' identified by 'chengshan' with grant option;