Centos6.5 64 在线安装mysql

1.查看是否有安装mysql文件

[root@localhost ~]# rpm -qa|grep mysql

Centos6.5 64 在线安装mysql_第1张图片

2.卸载mysql

[root@localhost ~]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64

Centos6.5 64 在线安装mysql_第2张图片

注意:如果以前安装过mysql,卸载命令如下:

yum remove mysql mysql-server mysql-libs mysql-common

rm -rf /var/lib/mysql

rm /etc/my.cnf

 查看是否还有mysql软件,有的话继续删除。

软件卸载完毕后如果需要可以删除mysql的数据库:/var/lib/mysql

3.在线yum mysql安装服务,中途会有2次提示问是否安装,全部输 Y 确定安装

[root@localhost ~]# yum install mysql-server

Centos6.5 64 在线安装mysql_第3张图片

4.启动mysql:[root@localhost ~]#service mysqld start

Centos6.5 64 在线安装mysql_第4张图片

5.给root设置密码:

/usr/bin/mysqladmin -u root password '这里输入你的新密码'

Centos6.5 64 在线安装mysql_第5张图片

Centos6.5 64 在线安装mysql_第6张图片

6.打开我们的mysql工具,我这里用的是Navicat Premium,连接之前先关闭我们的防火墙:

Navicat Premium下载地址:链接:https://pan.baidu.com/s/1m4LvE1Gvq_0Ecr1uvilaUg 密码:gajo

[root@localhost ~]# service iptables stop

永久关闭防火墙:chkconfig iptables off

Centos6.5 64 在线安装mysql_第7张图片

连接的时候会包无权限错误;

Centos6.5 64 在线安装mysql_第8张图片

6.远程连接授权,先用root登陆mysql

[root@localhost ~]# mysql -uroot -p(你的密码)

Centos6.5 64 在线安装mysql_第9张图片

授权远程连接

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

注意:'myuser''mypassword' 需要替换成实际的用户名和密码

Centos6.5 64 在线安装mysql_第10张图片

7.连接成功

Centos6.5 64 在线安装mysql_第11张图片

Centos6.5 64 在线安装mysql_第12张图片

8.虚拟机关闭之后,下次需要重新启动mysql服务:

[root@localhost ~]# service mysqld start

Centos6.5 64 在线安装mysql_第13张图片

安装完成!

你可能感兴趣的:(服务器)