资讯专栏INFORMATION COLUMN

CentOS 安装 MYSQL

huangjinnan / 2014人阅读

摘要:版本系统内核下载下载页面选择版本卸载旧版本查看是否安装了数据库安装配置执行命令启动确定确定确定查看服务关闭关闭启用启用启用启用关闭设置开机自启动查看版本连接安装配置完成

CentOS版本

cat /etc/redhat-release
>> CentOS release 5.4 (Final)

系统内核

uname -a
>> Linux test33x.ops.xxx.net 2.6.18-164.el5xen #1 SMP Thu Sep 3 04:03:03 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

MYSQL下载

下载页面

Select Platform
>> Red Hat Enterprise Linux / Oracle Linux

选择x86_64版本

MySQL-client-5.5.38-1.rhel5.x86_64.rpm
MySQL-server-5.5.38-1.rhel5.x86_64.rpm
MySQL-shared-5.5.38-1.rhel5.x86_64.rpm

卸载旧版本

yum remove mysql mysql-server mysql-libs
rm -rf /var/lib/mysql
rm /etc/my.cnf

rpm -qa|grep mysql //查看是否安装了mysql数据库
>> rpm -e mysql --nodeps

MYSQL安装

rpm -ivh MySQL-client-5.5.38-1.rhel5.x86_64.rpm
rpm -ivh MySQL-server-5.5.38-1.rhel5.x86_64.rpm
rpm -ivh MySQL-shared-5.5.38-1.rhel5.x86_64.rpm

配置

【执行命令】 /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we"ll need the current
password for the root user.  If you"ve just installed MySQL, and
you haven"t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
You already have a root password set, so you can safely answer "n".
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from "localhost".  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MySQL comes with a database named "test" that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done!  If you"ve completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!

启动MYSQL

service mysql start

>> Starting MySQL.                                            [确定]

service mysql status

>> MySQL running (32239)                                      [确定]

service mysql stop

>> Shutting down MySQL.                                       [确定]

查看服务

chkconfig --list | grep mysql

>> mysql            0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭

chkconfig mysql on  //设置开机自启动

查看版本

mysql -V

>> mysql  Ver 14.14 Distrib 5.5.38, for Linux (x86_64) using readline 5.1

连接MYSQL

mysql -u root -p

Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.5.38 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, 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> 

安装配置完成!

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/46360.html

相关文章

  • LNMP环境搭建(一):Mysql

    摘要:如果在未删除的情况下尝试在任一服务器上进行安装,安装将终止并显示一条错误消息以指向卸载卸载默认安装了编译安装官方文档下载相关源码下载,的相关依赖安装依赖是一个跨平台的安装编译工具,可以用简单的语句来描述所有平台的安装编译过程。 安装虚拟机 出于学习目的选择最小安装 选择启动项「第一项正常启动、第二项是修复模式」 showImg(https://segmentfault.com/img/...

    skinner 评论0 收藏0
  • 啊里云centos7.6编译安装NGINX+PHP7+MariaDB+MEMCACHED

    摘要:安装前准备修改默认主机名称安装依赖库删除系统默认数据库配置文件查询删除确认卸载系统自带查询删除安装数据库下载安装包解压创建数据库安装目录,数据存放目录, 安装前准备 修改默认主机名称 [root@iZuf60c5bxd15kr9gycvv6Z ~]# hostnamectl set-hostname centos [root@iZuf60c5bxd15kr9gycvv6Z ~]# re...

    yuanxin 评论0 收藏0
  • Centos7.4安装Mysql5.6

    摘要:查看有没有安装如果有,卸载卸载已有卸载旧版本的查看有没有安装如果有,卸载旧版本删除服务查看服务删除服务删除分散的文件夹查出相应的文件夹,也可以用删除安装依赖注意先装好依赖,再装。 环境 Centos7.4 工具 Xshell(远程终端模拟) FileZilla(给linux传输文件) 准备工作 1、 卸载MariaDB 注意:一定要将mariaDB包和自带mysql包卸载干净,否则...

    xi4oh4o 评论0 收藏0
  • Centos7.4安装Mysql5.6

    摘要:查看有没有安装如果有,卸载卸载已有卸载旧版本的查看有没有安装如果有,卸载旧版本删除服务查看服务删除服务删除分散的文件夹查出相应的文件夹,也可以用删除安装依赖注意先装好依赖,再装。 环境 Centos7.4 工具 Xshell(远程终端模拟) FileZilla(给linux传输文件) 准备工作 1、 卸载MariaDB 注意:一定要将mariaDB包和自带mysql包卸载干净,否则...

    Ku_Andrew 评论0 收藏0
  • linux安装mysql

    摘要:设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。可以看到只允许访问更新用户表强制刷新权限再次查看用户表。查看端口监听状态,修改配置文件这里可以看到表示所有均可访问。1.准备① 检测系统是否自带安装 MySQLrpm -qa | grep mysql如有,类似mysql-libs-5.1.52-1.el6_0.1.x86_64那可以选择进行卸载:rpm -e mysql-li...

    Tecode 评论0 收藏0
  • CentOS安装mysql

    摘要:为了方便快捷的搭建环境,于是有了这几篇文字使用安装安装安装安装下载进入目录下载解压修改名称解压修改名称添加用户和组添加用户组添加用户到用户组安装进入目录把目录权限分配给组下的用户安装安装语句报错执行 为了方便快捷的搭建linux环境,于是有了这几篇文字 CentOS使用yum安装jdk CentOS安装tomcat CentOS安装Nginx CentOS安装MySql 1下载my...

    tomlingtm 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<