CentOS——默认为安装5.1版本,如果需要安装5.5版本,需要使用remi源
yum install mysql-server –enablerepo=remi
 
Ubuntu——默认为安装5.5版本

apt-get install mysql-server

CentOS下直接yum安装

[root@10-4-5-9 ~]# yum list mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
mysql.x86_64 5.1.73-3.el6_5 updates

  

[root@10-4-5-9 ~]# wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
[root@10-4-5-9 ~]# ls
anaconda-ks.cfg epel-release-5-4.noarch.rpm install.log install.log.syslog
[root@10-4-5-9 ~]# rpm -ivh epel-release-5-4.noarch.rpm

#查看MySQL版本

[root@10-4-5-9 ~]# yum --enablerepo=remi,remi-test list mysql mysql-server

#安装MySQL

yum install mysql-server --enablerepo=remi

 

#查看安装好后的MySQL

 

[root@10-4-5-9 ~]# rpm -qa | grep mysql
mysql-5.5.39-1.el6.remi.x86_64
mysql-libs-5.5.39-1.el6.remi.x86_64
compat-mysql51-5.1.54-1.el6.remi.x86_64
mysql-server-5.5.39-1.el6.remi.x86_64

#启动MySQL

[root@10-4-5-9 ~]# service mysqld start
Starting mysqld: [ OK ]

  

#登陆MySQL

[root@10-4-5-9 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.39 MySQL Community Server (GPL) by Remi 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>

 

#查看MySQL用户

mysql> SELECT user,host FROM mysql.user;
+------+-----------+
| user | host |
+------+-----------+
| | 10-4-5-9 |
| root | 10-4-5-9 |
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| root | localhost |
+------+-----------+
6 rows in set (0.00 sec)

  

#删除空用户

DROP USER ''@'10-4-5-9';

DROP USER ''@'localhost';

DROP USER 'root'@'::1';

  

#修改密码

mysql> UPDATE mysql.user SET password = PASSWORD('********') WHERE user = 'root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

  

#重新登陆

[root@10-4-5-9 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.39 MySQL Community Server (GPL) by Remi 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>

一切OK。。。

 

CentOS 下安装MySQL 默认源为5.1版本的更多相关文章

  1. Centos下安装mysql 和挂载硬盘

    一,CentOS下安装Mysql 6.5 1.检测系统是否自带安装mysql # yum list installed | grep mysql 2.删除已经安装的Mysql # yum -y rem ...

  2. Centos下安装mysql 总结

    一.MySQL安装 Centos下安装mysql 请点开:http://www.centoscn.com/CentosServer/sql/2013/0817/1285.html 二.MySQL的几个 ...

  3. 【linux系列】Centos下安装mysql数据库

    前言 为了测试方便,通常我们会自己安装数据库,以下是在Centos上安装Mysql的操作. 一.检查自己是否安装了MySQL数据库 [root@s201 /home/mysql]#rpm -qa |g ...

  4. CentOS下安装mysql及配置使用

    最近一直使用的是CentOS,平时用的最多的数据库是Sql Server,对于mysql还停留在上学的时候,早已忘得一干二净,写这篇内容目的是,重新学习如何安装使用mysql. 一.安装mysql 操 ...

  5. CentOS下安装Mysql数据库

    其实,安装mysql数据库还是比较容易的,安装方式可以分为源码安装和二进制包安装.安装简单,只需要 yum安装几个包就可以搞定,安装后续其实还需要简单做些工作,才可以使用. 环境:CentOS 6.5 ...

  6. CentOS下安装MySQL

    首先通过网络链接的方式在线安装上mysql服务器端吧!(备注:我开始登录服务器的时候是用的其他用户而不是超级管理员,所以安装MySQL的时候需要切换到超级管理员才可以实现软件的正确安装.命令则是:su ...

  7. Linux/CentOS下安装MySql RPM Bundle

    一.下载对应的版本的MySql安装文件 1.下载路径 https://dev.mysql.com/downloads/mysql/ 2.选择对应的Linux版本和x86/x64位的安装文件 查看Lin ...

  8. Linux CentOs 下 安装 mysql nginx redis

    SCP 的使用 来源于: https://blog.csdn.net/qq_30968657/article/details/72912070 scp [参数] <源地址(用户名@IP地址或主机 ...

  9. Linux(Centos)下安装MySQL

    转载:http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html 一.mysql简介 说到数据库,我们大多想到的是关 ...

随机推荐

  1. jQuery和$、jQuery(function(){})和(function(){})(jQuery)

    1.$是JQuery的别名 ,在使用上是一样的,两者可以互换位置. $==jQuery; //true $===jQuery; //true 2.jQuery(function(){ ....... ...

  2. 虚拟信用卡 全球付, 工商银行国际E卡, Bancore, Entropay, Payoneer

    虚拟信用卡 海外网购.购买国外域名空间.ebay等一些国外网站账号的激活这些情况都需要用到国际信用卡, 如果没有信用卡或者有信用卡但是对于安全性有所顾虑怎么办? 其实有一种东西叫做虚拟信用卡,正规银行 ...

  3. ATMEL精妙的IRQ中断处理过程

    A: 从栈地址开始,栈顶为AT91SAM7S64的16K片内RAM尽头0x00204000IRQ_STACK_SIZE = 3*8*4FIQ_STACK_SIZE = 0x004ABT_STACK_S ...

  4. QT 开发资料

    http://pan.baidu.com/s/1bntYkpx 密码: fgsa

  5. json 数据类型,后台在组数据时,错一个标点符号,前端都解析不出来。

    json 数据类型,后台在组数据时,错一个标点符号,前端都解析不出来.

  6. nsstring 怎么包含”(引号)号

    使用转义字符 \ 即可.如下: [NSString *string = @"\"好\""]; NSLog("%@",string); 打印结 ...

  7. linux-修改时区时间

    所有笔记基于-CentOS release 6.8 (Final) ntpdate 202.120.2.101 同步上海时间 cp -f /usr/share/zoneinfo/Asia/Shangh ...

  8. [翻译] FTCoreText

    FTCoreText An open source Objective-C interface component that makes use of the CoreText framework t ...

  9. java通过System.getProperty获取系统属性

    getProperties public static Properties getProperties() 确定当前的系统属性. 首先,如果有安全管理器,则不带参数直接调用其 checkProper ...

  10. VMware虚拟机的三种联网方法及原理

    VMware虚拟机的三种联网方法及原理 博客分类: 操作系统 虚拟机Vmware互联网网络应用网络协议 一.Brigde——桥接  :默认使用VMnet0 1.原理: Bridge  桥"就 ...