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. Dropbox Folder Sync – 让 Dropbox 同步任意文件夹

    「DropBox」可以说是目前世界上最流行的线上同步工具,非常简单的同步方式, 流畅的档桉上传下载速度,让你可以轻易的在两台.三台电脑之间同步重要资料. 而你要做的步骤只是在每一台电脑安装DropBo ...

  2. PHP-输入变量

    在Web开发过程中,我们经常需要获取系统变量或者用户提交的数据,这些变量数据错综复杂,而且一不小心就容易引起安全隐患,但是如果利用好ThinkPHP提供的变量获取功能,就可以轻松的获取和驾驭变量了. ...

  3. Maven最佳实践 划分模块 配置多模块项目 pom modules

    所有用Maven管理的真实的项目都应该是分模块的,每个模块都对应着一个pom.xml.它们之间通过继承和聚合(也称作多模块,multi-module)相互关联.那么,为什么要这么做呢?我们明明在开发一 ...

  4. 【docker】docker部署spring boot项目在服务器上

    IDE:idea 工具:docker spring boot:2.0.1 ======================================== 简单记录一下流程,以供参考: 第一步:首先得 ...

  5. MySQL连接查询(inner join,left join和right join的区别)

    关系数据库由多个相关表组成,这些表使用已知为外键列的常用列链接在一起. 因此,从业务角度来看,每个表中的数据是不完整的. 例如,在示例数据库(yiibaidb)中,使用orderNumber列链接的o ...

  6. [翻译] DFXCoreTextView

    DFXCoreTextView https://github.com/davefoxy/DFXCoreTextView A CoreText wrapper for the formatting an ...

  7. AndEngine中文文档下载地址

    AndEngine doc  downloadhere 下载地址:http://pan.baidu.com/s/1bnjcL0V 文档是由github仓库AndEngine的代码生成. 本doc中包括 ...

  8. VUE router-view 页面布局 (嵌套路由+命名视图)

    嵌套路由 实际生活中的应用界面,通常由多层嵌套的组件组合而成.同样地,URL 中各段动态路径也按某种结构对应嵌套的各层组件,例如: /user/foo/profile /user/foo/posts ...

  9. Pow(x,n) leetcode java

    题目: Implement pow(x, n). 题解: pow(x,n)就是求x的n次方.x的N次方可以看做:x^n = x^(n/2)*x^(n/2)*x^(n%2).所以利用递归求解,当n==1 ...

  10. Sqrt(int x) leetcode java

    Reference: http://blog.csdn.net/lbyxiafei/article/details/9375735  题目: Implement int sqrt(int x). Co ...