linux离线安装mysql

1、安装包准备

MySQL服务包:MySQL-server-5.6.19-1.el6.x86_64.rpm

客户端连接包:MySQL-client-5.6.19-1.el6.x86_64.rpm

2、检查系统是否已经安装了mysql以及版本

可通过以下命令其一或组合进行检查

# ps -ef | grep mysql   //查看是否存在mysql运行进程

# rpm -qa|grep -i mysql   //查看是否安装已经安装包

如果没有返回信息,则系统没有安装mysql数据库。如果已经安装MySQL则需要删除旧的版本

如下图:(已安装)

[root@localhost local]# rpm -qa|grep -i mysql

mysql-libs-5.1.71-1.el6.x86_64

mysql-5.1.71-1.el6.x86_64

mysql-devel-5.1.71-1.el6.x86_64

[root@localhost local]#

 

3、卸载删除旧的mysql

注意:在删除之前停止mysql服务。

[root@localhost local]#ps -ef | grep mysql   //查看mysql运行进程

若有mysql正在运行,需要停止其运行:

Ø 方式一:服务停止

[root@localhost local]# service mysql stop

Ø 方式二:直接kill相关的进程

[root@localhost local]# kill -9 [进程号]

 

卸载mysql:rpm -e --nodeps +包名

对于操作系统默认安装的系统,大部分情况可能只需要2个rmp -e语句:

[root@localhost local]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64

[root@localhost local]# rpm -e --nodeps mysql-5.1.71-1.el6.x86_64

[root@localhost local]# rpm -e --nodeps mysql-devel-5.1.71-1.el6.x86_64

[root@localhost local]#

 

4、安装MySQL服务

将MySQL-server-5.6.19-1.el6.x86_64.rpm和MySQL-client-5.6.19-1.el6.x86_64.rpm两个文件上传到 /usr/local 目录下,然后使用以下命令:

[root@localhost ~]# cd /usr/local/

[root@localhost local]# rpm -ivh MySQL-server-5.6.19-1.el6.x86_64.rpm

Preparing...                ########################################### [100%]

   1:MySQL-server           ########################################### [100%]

2015-07-07 18:47:48 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-07-07 18:47:48 17624 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-07-07 18:47:48 17624 [Note] InnoDB: The InnoDB memory heap is disabled

2015-07-07 18:47:48 17624 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-07-07 18:47:48 17624 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-07-07 18:47:48 17624 [Note] InnoDB: Using Linux native AIO

2015-07-07 18:47:48 17624 [Note] InnoDB: Using CPU crc32 instructions

2015-07-07 18:47:48 17624 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-07-07 18:47:48 17624 [Note] InnoDB: Completed initialization of buffer pool

2015-07-07 18:47:48 17624 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!

2015-07-07 18:47:48 17624 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB

2015-07-07 18:47:48 17624 [Note] InnoDB: Database physically writes the file full: wait...

2015-07-07 18:47:49 17624 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

2015-07-07 18:47:51 17624 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

2015-07-07 18:47:53 17624 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

2015-07-07 18:47:53 17624 [Warning] InnoDB: New log files created, LSN=45781

2015-07-07 18:47:53 17624 [Note] InnoDB: Doublewrite buffer not found: creating new

2015-07-07 18:47:53 17624 [Note] InnoDB: Doublewrite buffer created

2015-07-07 18:47:53 17624 [Note] InnoDB: 128 rollback segment(s) are active.

2015-07-07 18:47:54 17624 [Warning] InnoDB: Creating foreign key constraint system tables.

2015-07-07 18:47:54 17624 [Note] InnoDB: Foreign key constraint system tables created

2015-07-07 18:47:54 17624 [Note] InnoDB: Creating tablespace and datafile system tables.

2015-07-07 18:47:54 17624 [Note] InnoDB: Tablespace and datafile system tables created.

2015-07-07 18:47:54 17624 [Note] InnoDB: Waiting for purge to start

2015-07-07 18:47:54 17624 [Note] InnoDB: 5.6.19 started; log sequence number 0

A random root password has been set. You will find it in '/root/.mysql_secret'.

2015-07-07 18:47:54 17624 [Note] Binlog end

2015-07-07 18:47:54 17624 [Note] InnoDB: FTS optimize thread exiting.

2015-07-07 18:47:54 17624 [Note] InnoDB: Starting shutdown...

2015-07-07 18:47:56 17624 [Note] InnoDB: Shutdown completed; log sequence number 1625977

 

 

2015-07-07 18:47:56 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-07-07 18:47:56 17650 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-07-07 18:47:56 17650 [Note] InnoDB: The InnoDB memory heap is disabled

2015-07-07 18:47:56 17650 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-07-07 18:47:56 17650 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-07-07 18:47:56 17650 [Note] InnoDB: Using Linux native AIO

2015-07-07 18:47:56 17650 [Note] InnoDB: Using CPU crc32 instructions

2015-07-07 18:47:56 17650 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-07-07 18:47:56 17650 [Note] InnoDB: Completed initialization of buffer pool

2015-07-07 18:47:56 17650 [Note] InnoDB: Highest supported file format is Barracuda.

2015-07-07 18:47:56 17650 [Note] InnoDB: 128 rollback segment(s) are active.

2015-07-07 18:47:56 17650 [Note] InnoDB: Waiting for purge to start

2015-07-07 18:47:56 17650 [Note] InnoDB: 5.6.19 started; log sequence number 1625977

2015-07-07 18:47:56 17650 [Note] Binlog end

2015-07-07 18:47:56 17650 [Note] InnoDB: FTS optimize thread exiting.

2015-07-07 18:47:56 17650 [Note] InnoDB: Starting shutdown...

2015-07-07 18:47:57 17650 [Note] InnoDB: Shutdown completed; log sequence number 1625987

 

 

 

 

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in '/root/.mysql_secret'.   //安装数据库时,此文件下可查看root的初始密码

 

You must change that password on your first connect,

no other statement but 'SET PASSWORD' will be accepted.

See the manual for the semantics of the 'password expired' flag.

 

Also, the account for the anonymous user has been removed.

 

In addition, you can run:

 

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.

This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

 

  http://www.mysql.com

 

Support MySQL by buying support/licenses at http://shop.mysql.com

 

New default config file was created as /usr/my.cnf and

will be used by default by the server when you start it.

You may edit this file to change server settings

 

[root@localhost local]#

有如上提供,则表示mysql服务安装成功。

 

5、安装MySQL5.6客户端

使用以下命令:

[root@localhost ~]# cd /usr/local/

[root@localhost local]# rpm -ivh MySQL-client-5.6.19-1.el6.x86_64.rpm

Preparing...                ########################################### [100%]

   1:MySQL-client           ########################################### [100%]

[root@localhost local]#

安装完成,如图:

6、安装完成后需要启动mysql:

[root@localhost local]# service mysql start

Starting MySQL. SUCCESS!

[root@localhost local]#

启动如下图:

 

mysql未启动如图:

由于离线安装时,若安装前已经存在旧mysql数据库,及可能设置有初始密码。不能无密码连接,且不能初始化密码,也不知道原密码。如下图所示:

出现该异常时,参见附录一(同见“3.2.4设置MySQL管理员(root)密码”异常二)中强制修改密码:

2、ERROR 1044 (42000):Access denied for user ''@'localhost' to database 'mysql'

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值