centos下yum安装mysql5.5

centos7.x安装代码:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/latest.rpm

centos6.x安装代码:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

centos5.x安装代码
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm

如果你之前安装过老版本的mysql(rpm -q mysql mysql-server), 你可以用下列命令升级:

yum install mysql.'uname -i' yum-plugin-replace
yum replace mysql --replace-with mysql55w

 

“yum install mysql” is only there to make sure yum-plugin-replace can resolve dependencies correctly if only mysql-server was installed.

如果没有安装过,运行下列命令进行安装mysql5.5:
yum install mysql55w mysql55w-server

You should upgrade existing tables before setting the server to become a production machine, which can be done by starting the server and running the mysql_upgrade script (this may take time depending on the size of the database).

启动mysql服务

service mysqld start

# This will issue a password prompt for the user. If you don’t have a root user password, remove the “-p”
mysql_upgrade -u root -p

设置开机启动
chkconfig mysqld on

设置MySQL的root用户设置密码[root@stonex ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
...... 省略了一些行
mysql> select user,host,password from mysql.user;
查询用户的密码,都为空,用下面的命令设置root的密码为root
mysql> set password for root@localhost=password('root');
mysql> exit

 

 

 

打赏
Bookmark the permalink.
0 0 投票数
文章评分
订阅评论
提醒
guest

0 评论
内联反馈
查看所有评论