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. yyyy/M/d h:m:s 转换成 yyyy-MM-dd hh:mm:ss

    var arrTime = (dtime).replace("/", "-").replace("/", "-"); v ...

  2. Visual Studio《加载此属性页时出错》的解决办法

    打开aspx页面时不能切换到设计视图,vs 2008工具箱中无控件.打开vs 2008的工具>选项>HTML设计器时提示:加载此属性页时出错 有时还会有其它错误提示,比如打开一个Windo ...

  3. [moka同学笔记]yii2.0小物件的简单使用(第一种方法)

    这是第一种方法,还有另一种方法,其实都差不多. 1.在创建widgets\HelloWiget.php <?php /** * Created by PhpStorm. * User: Admi ...

  4. 两种设计模式(1)==>>“简单工厂”

    我们以做一个计算器为例,给大家介绍简单工厂的应用: 效果: 这里我们使用 继承 ,虚方法, 简单工厂的设计模式来完成 首先,我们除了搭好窗体外,我们应该把我们的一些类准备好: 1.计算的父类Calcu ...

  5. SQL Server Insert时开启显式事务

    如果没法避免一条一条的写入,那么在处理前显示开启一个事务 begin tran  在处理完成后 commit 这样也要比不开显示事务会快很多! while i < 10000begin inse ...

  6. 什么是CSR证书申请文件?

      CSR是Cerificate Signing Request的英文缩写,即证书请求文件,在多方之间在互联网上安全分享数据的公钥基础架构PKI系统中,CSR文件必须在申请和购买SSL证书之前创建.也 ...

  7. C# Winform 窗体美化

    using System; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using Sys ...

  8. 为阿里云存储开发的PHP PEAR 包:Services_Aliyun_OSS

    阿里云开放存储服务 OSS:用于存储图片.apk等静态资源,使用阿里云带宽,不占用开发者服务器带宽. 阿里云官方PHP SDK: http://aliyun.com/product/oss/#help ...

  9. SharePoint 2013 Workflow 分布式配置问题记录

    SharePoint 2013 发布已经有一段时间,前段事件主要是做财务项目,用到Oracle和HFM,由于从来没了解过这两个软件,把大部分时间用在了学习Oracle和HFM的API,目前对HFM的A ...

  10. 使用svcutil.exe 工具来生成调用文件

    svcutil.exe http://localhost:9065/ServiceDemo.svc?wsdl 这将生成一个配置文件和一个包含客户端类的代码文件. 下面我们就用这个是怎么生成的: 1,打 ...