之前用rpm安装方式安装不成功,换成yum安装之后安装ok了,尤其是centos7.x与centos6.x做了很大的改变,可能别人的6.x不适合7.x的安装,先卸载已经存在的mysql。
-
[root@shizongger bin]# rpm -qa|grep mysql
-
[root@shizongger bin]# rpm -qa mysql
-
[root@shizongger bin]# rpm -qa|grep -i mysql
-
MySQL-client-5.5.54-1.el7.x86_64
-
[root@shizongger bin]# rpm -e --nodeps M
-
ModemManager ModemManager-glib MySQL-client
-
[root@shizongger bin]# rpm -e --nodeps MySQL-client
更新mysql的yum源
-
[root@shizongger bin]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
-
[root@shizongger bin]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum安装
-
[root@shizongger bin]# yum install mysql-community-server
不出意外,mysql就已经安装成功,因为yum安装是傻瓜式安装嘛,现在启动mysql服务。
-
[root@shizongger bin]# service mysqld start
mysql监听的段口号是:3306,现在我们来监听3306端口是否已经启动:
-
[shizongger@shizongger src]$ netstat -anp |grep 3306
-
(Not all processes could be identified, non-owned process info
-
will not be shown, you would have to be root to see it all.)
-
tcp6 0 0 :::3306 :::* LISTEN -
ok,mysql服务已经起来了,可以登陆数据库了,第一次登陆数据密码为空,然后再去给数据库配置root的密码。
-
[root@shizongger bin]# mysql -uroot
-
mysql> set password for 'root'@'localhost' = password('root');
-
mysql>exit
用新的密码登陆
-
[root@shizongger bin]# mysql -uroot -proot
-
mysql> show database;
-
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
-
mysql> show databases;
-
+--------------------+
-
| Database |
-
+--------------------+
-
| information_schema |
-
| mysql |
-
| performance_schema |
-
+--------------------+
最后停止mysql服务的命令是:
-
[root@shizongger bin]# service mysqld stop
阅读(419) | 评论(0) | 转发(0) |