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. 简单的文件上传html+ashx

    前台页面:<form action="upload.ashx" method="post" enctype="multipart/form-da ...

  2. MVC使用Gantt Chart实现甘特图,管理事情进度

    借助"甘特图",可以直观地了解任务.活动.工作的进度.dhtmlxGantt是一个开源的Javacirpt库,能帮助我们快速创建"甘特图",本篇体验在MVC中的 ...

  3. SQL语句200条(转)

    //重建数据库 101, create database testdatabase;use database testdatabase; 102, create table tt1(id int, n ...

  4. 算法:基于 RingBuffer 的 Deque 实现

    背景 前两篇文章介绍了 Queue 的实现,很多类库都引入了 Deque,Deque 可以两头添加和删除,然后在 Deque 之上构建 Queue 和 Stack. Deque 代码 using Sy ...

  5. .NET:CLR via C#:Runtime Serialization

    Making a Type Serializable The SerializableAttribute custom attribute may be applied to reference ty ...

  6. PHP 7.0 5.6 下安裝 phpLDAPadmin 发生错误的修正方法

    在稍具規模的網路環境中, 網管時常選用 LDAP 來進行帳號的統整管理, 一方面提供管理便利度, 另一方面使用者也不必因為不同系統而記憶不同帳號, phpLDAPadmin 是一套常見的 LDAP 管 ...

  7. python urlopen SSL: CERTIFICATE_VERIFY_FAILED

    1.使用ssl创建未经验证的上下文,在urlopen中传入上下文参数 import sslimport urllib2 context = ssl._create_unverified_context ...

  8. 【六】注入框架RoboGuice使用:(Singletons And ContextSingletons)

    上一篇我们简单的介绍了一下RoboGuice的使用([五]注入框架RoboGuice使用:(Your First POJO Injection)),今天我们来看下单例以及上下文单例(ContextSi ...

  9. elimination-game

    https://leetcode.com/problems/elimination-game/ // 一行代码就可以,不过原理有些复杂 // https://discuss.leetcode.com/ ...

  10. go语言基础之结构体比较和赋值

    1.结构体比较和赋值 (同类型的结构体可以相互赋值) 示例: package main //必须有个main包 import "fmt" //定义一个结构体类型 type Stud ...