Linux下Mysql安装

1、下载安装包

     首先查看Linux版本:

Linux下Mysql安装
[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
Linux下Mysql安装

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

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

2、安装Mysql服务和客户端

Linux下Mysql安装
rpm -ivh MySQL-server-5.5.36-1.el6.x86_64.rpm
Linux下Mysql安装
Linux下Mysql安装
[root@localhost mysql]# rpm -ivh MySQL-server-5.5.36-1.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]

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%]

Linux下Mysql安装

可能遇到的问题

1>如果出现类似:

Linux下Mysql安装
file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-5.5.36-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.61-4.el6.x86_64
    file /usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.5.36-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.61-4.el6.x86_64
    file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.5.36-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.61-4.el6.x86_64
    file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-5.5.36-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.61-4.el6.x86_64
    file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.5.36-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.61-4.el6.x86_64
    file /usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.5.36-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.61-4.el6.x86_64
Linux下Mysql安装

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

Linux下Mysql安装
yum -y remove mysql-libs-5.1.61*
Linux下Mysql安装

2>如果移除时出现:

Linux下Mysql安装
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 14110.
Linux下Mysql安装

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

Linux下Mysql安装
rm -f    /var/run/yum.pid
Linux下Mysql安装

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‘

Linux下Mysql安装,布布扣,bubuko.com

Linux下Mysql安装

上一篇:IMP-00013: 只有 DBA 才能导入由其他 DBA 导出的文件


下一篇:ORACLE clusterware组成