1、下载安装包

首先查看Linux版本:

[root@localhost ~]# lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.3 (Santiago)
Release: 6.3
Codename: Santiago

  结果显示系统为64位Redhat6.3 ,去Mysql官网(http://dev.mysql.com/downloads/mysql#downloads)下载相应的版本。

wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-devel-5.5.36-1.el6.x86_64.rpm
wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-client-5.5.36-1.el6.x86_64.rpm
wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-server-5.5.36-1.el6.x86_64.rpm

2、安装Mysql服务和客户端

rpm -ivh MySQL-server-5.5.-.el6.x86_64.rpm
[root@localhost mysql]# rpm -ivh MySQL-server-5.5.-.el6.x86_64.rpm
Preparing... ########################################### [%]
:MySQL-server ########################################### [%] PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost password 'new-password' Alternatively you can run:
/usr/bin/mysql_secure_installation which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers. See the manual for more instructions. Please report any problems at http://bugs.mysql.com/

[root@localhost mysql]# rpm -ivh MySQL-client-5.5.36-1.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]

可能遇到的问题

1>如果出现类似:

file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-5.5.-.el6.x86_64 conflicts with file from package mysql-libs-5.1.-.el6.x86_64
file /usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.5.-.el6.x86_64 conflicts with file from package mysql-libs-5.1.-.el6.x86_64
file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.5.-.el6.x86_64 conflicts with file from package mysql-libs-5.1.-.el6.x86_64
file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-5.5.-.el6.x86_64 conflicts with file from package mysql-libs-5.1.-.el6.x86_64
file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.5.-.el6.x86_64 conflicts with file from package mysql-libs-5.1.-.el6.x86_64
file /usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.5.-.el6.x86_64 conflicts with file from package mysql-libs-5.1.-.el6.x86_64

说明有包冲突,这时候要移除冲突的包,使用命令:

yum -y remove mysql-libs-5.1.*

2>如果移除时出现:

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Existing lock /var/run/yum.pid: another copy is running as pid .

说明YUM正在更新,使用命令:

rm -f    /var/run/yum.pid

3、服务启动、停止、重新启动

[root@localhost usr]# service mysql start

[root@localhost usr]# service mysql stop

[root@localhost usr]# service mysql restart

4、修改root密码

[root@localhost bin]# mysqladmin -u root -p'root' password 'rockontrol'

5、常见问题

登录出现 Access denied for user 'root'@'localhost' (using password:YES)。解决步骤如下:

a:以root用户登录系统

b:看一下Mysql服务的状态 如果启动则杀掉进程 命令如下

[root@localhost ~]# /etc/init.d/mysql status
ERROR! MySQL is running but PID file could not be found
[root@localhost ~]# ps aux|grep mysql
root 0.0 0.0 ? S 6月16 : /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid
mysql 0.0 2.7 ? Sl 6月16 : /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=/var/lib/mysql/localhost.localdomain.pid
root 0.0 0.0 pts/ S+ : : grep --color=auto mysql
[root@localhost ~]# kill
[root@localhost ~]# kill
[root@localhost ~]# kill

c:启动特权命令:mysqld_safe --skip-grant-tables &

d:在重新打开一个连接以普通用户命令进去   这时候就不需要在输入密码了

[root@localhost ~]# mysql -u root -p
Enter password:

直接回车就可以进去了   然后修改user表的密码就可以了

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 host,user,password from user;
+-----------------------+------+-------------------------------------------+
| host | user | password |
+-----------------------+------+-------------------------------------------+
| localhost | root | *68A463BD53874E39A4D68117C03FB1A777EC9DA9 |
| localhost.localdomain | root | *68A463BD53874E39A4D68117C03FB1A777EC9DA9 |
| 127.0.0.1 | root | *68A463BD53874E39A4D68117C03FB1A777EC9DA9 |
| :: | root | *68A463BD53874E39A4D68117C03FB1A777EC9DA9 |
+-----------------------+------+-------------------------------------------+
rows in set (0.00 sec) mysql> update user set host='%' where host='localhost';
Query OK, row affected (0.00 sec)
Rows matched: Changed: Warnings: mysql> update user set password='';
Query OK, rows affected (0.00 sec)
Rows matched: Changed: Warnings:

这样就清空所有的密码了
e:这时候可以退出特权模式 重新启动Mysql服务  然后修改一下密码就可以了

SET PASSWORD=PASSWORD('');

Linux下Mysql安装的更多相关文章

  1. linux下MySQL安装登录及操作

    linux下MySQL安装登录及操作 二.安装Mysql 1.下载MySQL的安装文件 安装MySQL需要下面两个文件: MySQL-server-4.0.16-0.i386.rpm MySQL-cl ...

  2. Linux下MySQL安装和配置

    --Linux下MySQL安装和配置 ---------------------------2014/05/18 Linux下MySQL的配置和安装 本文的安装采用 rpm 包安装 1.首先在官网下载 ...

  3. Linux下Mysql安装(RPM安装)

    1. 首先检查机器里是否已经存在MySQL $ rpm -qa | grep mysql 2. 去官网下载相应的rpm包:https://dev.mysql.com/downloads/mysql/ ...

  4. Linux下MySQL安装及配置

    Linux下MySQL安装及配置 安装MySQL Ubuntu系统中,直接使用apt install的方式去安装MySQL的服务端和客户端,MySQL的客户端必须安装,否则无法通过命令连接并操作MyS ...

  5. linux 下 mysql安装和配置

    最近在学习R语言,看到R与数据库交互这一部分,就自己动手实践了一下,数据库选择的是mysql,主要记录下linux下怎么安装mysql. 网上的很多资料都有相关的文章,这里只是记录下自己安装过程中遇到 ...

  6. Linux下mysql安装过程

    到mysql官网下载mysql编译好的二进制安装包,在下载页面Select Platform:选项选择linux-generic,然后把页面拉到底部,64位系统下载Linux - Generic (g ...

  7. Linux下Mysql安装教程详解

    Linux下软件安装一般有三种方式:RPM包方式(通过Redhat 第三方包管理系统).二进制包和源码包.本篇主要介绍二进制包安装mysql数据库的方式. 如何获取二进制源码包 当然是到mysql官网 ...

  8. Linux下mysql安装记录

    1.MySQL下载路径:https://dev.mysql.com/downloads/ Linux下的安装步骤:http://www.runoob.com/linux/mysql-install-s ...

  9. linux下MySQL安装及设置

    转自:http://www.entage.net/1/viewspace-25420 1. 关于本文    本文将以MySQL 5.0.51为例,以CentOS 5为平台,讲述MySQL数据库的安装和 ...

  10. linux下mysql安装报错及修改密码登录等等

    1:下载 [root@localhost soft]# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc ...

随机推荐

  1. 重构第9天:提取接口(Extract Interface)

    理解:提取接口的意思是,多于一个类共同使用某个类中的方法或属性,那么我们可以把这些方法和属性提出来,作为一个单独的接口.这样的好处是解除代码间的依赖,降低耦合性. 详解: 先看重构前的代码: publ ...

  2. css 样式表

    CSS(cascading style sheets,层叠样式表),作用是美化HTML网页. /*注释*/   注释语法 2.1 样式表的基本概念 2.1.1样式表的分类 1.内联样式表 和HTML联 ...

  3. 缺少google api密钥,因此chromium的部分功能将无法使用”的解决办法

            使用Chromium时会遇到 "缺少google api密钥,因此chromium的部分功能将无法使用"提示,google了一下 setx Google_API_K ...

  4. 【JS复习笔记】02 对象与函数

    好吧,因为很重要的事情,几天没写笔记了. 关于对象: ||可以用来填充默认值,如:myApp.name || "无" &&可以用来避免错误,myApp.NameOb ...

  5. Gson解析的小例子

    最近解析些复杂的节点数据解析,用安卓自带的json解析比较麻烦所以只能用Gson解析,所以从网上下了点demo来看看 http://blog.csdn.net/tkwxty/article/detai ...

  6. .NET Core Roadmap

    This post was written by Scott Hunter. It has been about two weeks since we shipped .NET Core / ASP. ...

  7. SQL Server的各种表

    以下表格简便易懂 请认真仔细斟酌! 字符串函数: 字符串函数用于对字符串数据进行处理,并返回一个字符串或者数字. 函数名 描述 例子 CHARINDEX 用来寻找一个指定的字符串在另一个字符串中的起始 ...

  8. html与js的取值,赋值

    -------------------------------------------------- ------------------------------------------------- ...

  9. js argument实参集合与局部变量、参数关系

    形参 形式上传递的参数 function fn1(a,b,c) {//a,b,c就是形参 实参 实际传递的参数 fn1 (1,2,5);//1,2,5就是实参 argument 定义: 实参的集合 用 ...

  10. JSP利用freemarker生成基于word模板的word文档

    利用freemarker生成基于word模板的word文档 freemarker简介 FreeMarker是一个用Java语言编写的模板引擎,它基于模板来生成文本输出.FreeMarker与Web容器 ...