使用下面的命令检查是否安装有MySQL Server
[root@localhost etc]# rpm -qa | grep mysql // 这个命令就会查看该操作系统上是否已经安装了mysql数据库
有的话,我们就通过 rpm -e 命令 或者 rpm -e --nodeps 命令来卸载掉
[root@localhost ~]# rpm -e mysql // 普通删除模式 [root@localhost ~]# rpm -e --nodeps mysql // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
在删除完以后我们可以通过 rpm -qa | grep mysql 命令来查看mysql是否已经卸载成功!!
官网yum repository 下载安装包
[root@localhost ~]# wget http://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm --2017-04-24 18:53:49-- http://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm Resolving dev.mysql.com... 137.254.60.11 Connecting to dev.mysql.com|137.254.60.11|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: https://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm [following] --2017-04-24 18:53:49-- https://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm Connecting to dev.mysql.com|137.254.60.11|:443... connected. ERROR: certificate common name “www.mysql.com” doesn't match requested host name “dev.mysql.com”. To connect to dev.mysql.com insecurely, use ‘--no-check-certificate'
本地安装下载下来的rpm包
[root@localhost ~]# yum localinstall mysql57-community-release-el6-10.noarch.rpm Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Local Package Process Examining mysql57-community-release-el6-10.noarch.rpm: mysql57-community-release-el6-10.noarch Marking mysql57-community-release-el6-10.noarch.rpm to be installed Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * extras: mirrors.cn99.com * updates: mirrors.cn99.com Resolving Dependencies --> Running transaction check ---> Package mysql57-community-release.noarch 0:el6-10 will be installed --> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================================== Installing: mysql57-community-release noarch el6-10 /mysql57-community-release-el6-10.noarch 30 k Transaction Summary =============================================================================================================================================================================================== Install 1 Package(s) Total size: 30 k Installed size: 30 k Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : mysql57-community-release-el6-10.noarch 1/1 Verifying : mysql57-community-release-el6-10.noarch 1/1 Installed: mysql57-community-release.noarch 0:el6-10 Complete!
查看可用的安装包
[root@localhost ~]# yum repolist enabled|grep mysql mysql-connectors-community MySQL Connectors Community 33 mysql-tools-community MySQL Tools Community 47 mysql57-community MySQL 5.7 Community Server 183
安装前装gcc所有包,防止报错[Errno -1] Package does not match intended download
[root@localhost yum.repos.d]# yum install gcc*
安装mysql
[root@localhost yum.repos.d]# yum install -y mysql-community-server Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * extras: mirrors.cn99.com * updates: mirrors.cn99.com Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql-community-server.x86_64 0:5.7.18-1.el6 will be installed --> Processing Dependency: mysql-community-common(x86-64) = 5.7.18-1.el6 for package: mysql-community-server-5.7.18-1.el6.x86_64 --> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.18-1.el6.x86_64 --> Running transaction check ---> Package mysql-community-client.x86_64 0:5.7.18-1.el6 will be installed --> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.18-1.el6.x86_64 ---> Package mysql-community-common.x86_64 0:5.7.18-1.el6 will be installed --> Running transaction check ---> Package mysql-community-libs.x86_64 0:5.7.18-1.el6 will be obsoleting ---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be obsoleted --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64 --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64 --> Running transaction check ---> Package mysql-community-libs-compat.x86_64 0:5.7.18-1.el6 will be obsoleting ---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be updated ---> Package postfix.x86_64 2:2.6.6-8.el6 will be an update --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: mysql-community-libs x86_64 5.7.18-1.el6 mysql57-community 2.1 M replacing mysql-libs.x86_64 5.1.71-1.el6 mysql-community-libs-compat x86_64 5.7.18-1.el6 mysql57-community 1.6 M replacing mysql-libs.x86_64 5.1.71-1.el6 mysql-community-server x86_64 5.7.18-1.el6 mysql57-community 152 M Installing for dependencies: mysql-community-client x86_64 5.7.18-1.el6 mysql57-community 23 M mysql-community-common x86_64 5.7.18-1.el6 mysql57-community 328 k Updating for dependencies: postfix x86_64 2:2.6.6-8.el6 base 2.0 M Transaction Summary ============================================================================================================================= Install 5 Package(s) Upgrade 1 Package(s) Total size: 180 M Total download size: 152 M Downloading Packages: mysql-community-server-5.7.18-1.el6.x86_64.rpm | 152 MB 01:41 warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Importing GPG key 0x5072E1F5: Userid : MySQL Release Engineering <mysql-build@oss.oracle.com> Package: mysql57-community-release-el6-10.noarch (@/mysql57-community-release-el6-10.noarch) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : mysql-community-common-5.7.18-1.el6.x86_64 1/8 Installing : mysql-community-libs-5.7.18-1.el6.x86_64 2/8 Installing : mysql-community-libs-compat-5.7.18-1.el6.x86_64 3/8 Installing : mysql-community-client-5.7.18-1.el6.x86_64 4/8 Installing : mysql-community-server-5.7.18-1.el6.x86_64 5/8 Updating : 2:postfix-2.6.6-8.el6.x86_64 6/8 Cleanup : 2:postfix-2.6.6-2.2.el6_1.x86_64 7/8 Erasing : mysql-libs-5.1.71-1.el6.x86_64 8/8 Verifying : 2:postfix-2.6.6-8.el6.x86_64 1/8 Verifying : mysql-community-libs-compat-5.7.18-1.el6.x86_64 2/8 Verifying : mysql-community-server-5.7.18-1.el6.x86_64 3/8 Verifying : mysql-community-libs-5.7.18-1.el6.x86_64 4/8 Verifying : mysql-community-common-5.7.18-1.el6.x86_64 5/8 Verifying : mysql-community-client-5.7.18-1.el6.x86_64 6/8 Verifying : 2:postfix-2.6.6-2.2.el6_1.x86_64 7/8 Verifying : mysql-libs-5.1.71-1.el6.x86_64 8/8 Installed: mysql-community-libs.x86_64 0:5.7.18-1.el6 mysql-community-libs-compat.x86_64 0:5.7.18-1.el6 mysql-community-server.x86_64 0:5.7.18-1.el6 Dependency Installed: mysql-community-client.x86_64 0:5.7.18-1.el6 mysql-community-common.x86_64 0:5.7.18-1.el6 Dependency Updated: postfix.x86_64 2:2.6.6-8.el6 Replaced: mysql-libs.x86_64 0:5.1.71-1.el6 Complete!
启动mysql
[root@localhost yum.repos.d]# service mysqld start Initializing MySQL database: [ OK ] Installing validate password plugin: [ OK ] Starting mysqld:
进入mysql安全模式
[root@localhost yum.repos.d]# killall -TERM mysqld
[root@localhost yum.repos.d]# mysqld_safe --skip-grant-tables &
[1] 40422
[root@localhost yum.repos.d]# 2017-04-25T07:45:39.222061Z mysqld_safe Logging to '/var/log/mysqld.log'.
2017-04-25T07:45:39.246117Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from users;
ERROR 1146 (42S02): Table 'mysql.users' doesn't exist
mysql> select * from user;
mysql> update user set authentication_string=PASSWORD('mysql') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> quit
Bye
[2]+ Exit 1 mysqld_safe --skip-grant-tables
[root@localhost yum.repos.d]# service mysqld start
Starting mysqld: [ OK ]
[root@localhost yum.repos.d]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql -h主机地址 -u用户名 -p用户密码
1、例1:连接到本机上的MYSQL
找到mysql的安装目录,一般可以直接键入命令mysql -uroot -p,回车后提示你输密码,如果刚安装好MYSQL,超级用户root是没有密码的,故直接回车即可进入到MYSQL中
了,MYSQL的提示符是:mysql>
2、连接到远程主机上的MYSQL
假设远程主机的IP为:10.0.0.1,用户名为root,密码为123。则键入以下命令:
mysql -h10.0.0.1 -uroot -p123
(注:u与root可以不用加空格,其它也一样)
配置防火墙
防火墙的3306端口默认没有开启,若要远程访问,需要开启这个端口
打开/etc/sysconfig/iptables
在“-A INPUT –m state --state NEW –m tcp –p tcp –dport 22 –j ACCEPT”,下添加:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
然后保存,并关闭该文件,在终端内运行下面的命令,刷新防火墙配置:
service iptables restart OK,一切配置完毕,你可以访问你的MySQL了~
注意:增加的开放3306端口的语句一定要在icmp-host-prohibited之前
mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
以上所述是小编给大家介绍的centos 6.5下 mysql-community-server. 5.7.18-1.el6安装,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
# centos
# mysql
# server
# mysql installer community 8.0.16.0安装配置图文教程
# mysql installer community 5.7.16安装详细教程
# mysql installer web community 5.7.21.0.msi安装图文教程
# mysql installer community 8.0.12.0安装图文教程
# MySQL Installer is running in Community mode 的解决办法
# MySQL Community Server 8.0.11安装配置方法图文教程
# Unity连接MySQL并读取表格数据的实现代码
# 连接到
# 小编
# 安装包
# 就会
# 你可以
# 在此
# 我们可以
# 对其
# 给大家
# 可以直接
# 报错
# 它也
# 机上
# 所述
# 若要
# 该文件
# 给我留言
# 官网
# 感谢大家
# 装好
相关文章:
建站之星logo尺寸如何设置最合适?
如何通过二级域名建站提升品牌影响力?
如何高效利用200m空间完成建站?
制作电商网页,电商供应链怎么做?
如何快速生成凡客建站的专业级图册?
如何零成本快速生成个人自助网站?
c# 在高并发场景下,委托和接口调用的性能对比
宿州网站制作公司兴策,安徽省低保查询网站?
昆明网站制作哪家好,昆明公租房申请网上登录入口?
免费网站制作appp,免费制作app哪个平台好?
linux top下的 minerd 木马清除方法
如何用PHP工具快速搭建高效网站?
如何通过虚拟主机快速搭建个人网站?
关于BootStrap modal 在IOS9中不能弹出的解决方法(IOS 9 bootstrap modal ios 9 noticework)
如何快速重置建站主机并恢复默认配置?
音响网站制作视频教程,隆霸音响官方网站?
齐河建站公司:营销型网站建设与SEO优化双核驱动策略
如何通过wdcp面板快速创建网站?
Java解压缩zip - 解压缩多个文件或文件夹实例
建站之星如何保障用户数据免受黑客入侵?
如何通过cPanel快速搭建网站?
如何在香港服务器上快速搭建免备案网站?
矢量图网站制作软件,用千图网的一张矢量图做公司app首页,该网站并未说明版权等问题,这样做算不算侵权?应该如何解决?
网页设计网站制作软件,microsoft office哪个可以创建网页?
如何通过云梦建站系统实现SEO快速优化?
如何选择高效响应式自助建站源码系统?
如何通过NAT技术实现内网高效建站?
高端建站三要素:定制模板、企业官网与响应式设计优化
,石家庄四十八中学官网?
如何选择高性价比服务器搭建个人网站?
网站制作新手教程,新手建设一个网站需要注意些什么?
建站之星后台密码遗忘或太弱?如何重置与强化?
如何用5美元大硬盘VPS安全高效搭建个人网站?
如何在局域网内绑定自建网站域名?
大型企业网站制作流程,做网站需要注册公司吗?
如何在新浪SAE免费搭建个人博客?
网站制作公司广州有几家,广州尚艺美发学校网站是多少?
如何在云服务器上快速搭建个人网站?
建站主机服务器选购指南:轻量应用与VPS配置解析
如何制作算命网站,怎么注册算命网站?
mc皮肤壁纸制作器,苹果平板怎么设置自己想要的壁纸我的世界?
深圳 网站制作,深圳招聘网站哪个比较好一点啊?
开封网站制作公司,网络用语开封是什么意思?
山东网站制作公司有哪些,山东大源集团官网?
唐山网站制作公司有哪些,唐山找工作哪个网站最靠谱?
微信网站制作公司有哪些,民生银行办理公司开户怎么在微信网页上查询进度?
如何选择服务器才能高效搭建专属网站?
javascript中的try catch异常捕获机制用法分析
小建面朝正北,A点实际方位是否存在偏差?
东莞专业网站制作公司有哪些,东莞招聘网站哪个好?
*请认真填写需求信息,我们会在24小时内与您取得联系。