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. Jquery:ajax跨域请求处理

    昨天朋友想做个图片懒加载的效果,朋友是前端的,我这边给他提供数据,程序写好了放到服务器上,本地测试访问时却报jquery跨域的问题,于是找度娘了解了一下jquey如何处理,网上有很多参考文章,但没细看 ...

  2. margin的使用方法与技巧

    1.margin还可以用来做平移,作用类似translate哈哈.将元素设成absolute后就可以用margin随便平移他了,既不像relative那样要霸占空间,又不用为父元素设置relative ...

  3. SQL compute by 的使用

    SQL compute by 的使用 摘自:http://www.cnblogs.com/Gavinzhao/archive/2010/07/12/1776107.html GROUP BY子句有个缺 ...

  4. c#重点[集合类型]异常,数组,集合ArrayList,List<>,hashTable,hashtable泛型(Dictionary)

    1.foreach[对一些数组或集合进行遍历] foreach(类型 变量名 in 集合对象){语句体} //定义一个数组 ,,,,, }; foreach(var i in sNum1) { Con ...

  5. 不可或缺 Windows Native (3) - C 语言: 运算符,表达式,条件语句,循环语句,转向语句,空语句等

    [源码下载] 不可或缺 Windows Native (3) - C 语言: 运算符,表达式,条件语句,循环语句,转向语句,空语句等 作者:webabcd 介绍不可或缺 Windows Native  ...

  6. 切换到percona server各种问题

    这两天把七八台服务器全部切换到了percona server,相关注意事项如下: 1.JDBC报ERROR 1862 (HY000): Your password has expired. To lo ...

  7. js 中{},[]中括号,大括号

    1. { } 大括号,表示定义一个对象,大部分情况下要有成对的属性和值,或是函数. 如: var LangShen = {"Name":"Langshen",& ...

  8. vIDC v2.0 强大的端口转发神器使用总结-开放内网tfs代码服务

    vIDC2.0 端口映射工具,最近在公司闲来无事,想自己整个tfs来管理自己的研究代码. 本来是想用微软Visual Studio提供的免费tfs,但是无奈速度太慢.他们的服务器在美国,中国也没有代理 ...

  9. tomcat已 .war 包的形式发布项目

    一:首相将写好的工程打成.war 文件包, 借助eclipse工具完成. 右键项目名称 --> Export --> WAR file  进入如下图 二: 进入到Tomcat的 webap ...

  10. GTD3年来读的52本书

    2012年   1.一生的计划 平衡:人生要在精神.理财.教育和娱乐4个方面进行平衡.   2.重来REWORK 小型软件公司的创业与软件项目的管理 不要管全年计划,只要找出下一项最重要的任务,然后起 ...