教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 文库大全 > 幼儿教育 >

CENTOS 5.2 X64下MySQL安装、Windows下MySQL安装、迁移部署、主

来源:网络收集 时间:2026-08-02
导读: MySQL安装配置、迁移部署、主从互备、双机高可用性集群 un_1.2 CENTOS 5.2 X64下MySQL安装、迁移部署、双机热备 2010年9月3日星期五 一、 模拟安装环境 虚拟机Virtual Machine 6.0 操作系统:CentOS release 5.2 (Final) MySQL RPM安装包: MySQL-client-com

MySQL安装配置、迁移部署、主从互备、双机高可用性集群

<un_1.2>

CENTOS 5.2 X64下MySQL安装、迁移部署、双机热备

2010年9月3日星期五

一、 模拟安装环境

虚拟机Virtual Machine 6.0

操作系统:CentOS release 5.2 (Final) MySQL RPM安装包:

MySQL-client-community-5.1.50-1.rhel4.x86_64.rpm MySQL-client-community-5.1.50-1.rhel4.x86_64.rpm

源码编译安装包: MySQL-5.1.34.tar.gz

备注: MySQL安装可能需要一些必备组件,具体组件未详究。解决方法,1、可以将服务器连接互 联网安装过程中会自动下载所需组件;2、将系统安装DVD盘放于光驱中,安装过程中会自动去光盘加载需要的组件进行安装。

二、 MySQL RPM包安装方式

2.1、上传RPM包至/root目录

[root@test ~]# ls

MySQL-client-community-5.1.50-1.rhel4.x86_64.rpm MySQL-server-community-5.1.50-1.rhel5.x86_64.rpm 2.2、安装MySQL服务器端

[root@test ~]# rpm -ivh MySQL-server-community-5.1.50-1.rhel5.x86_64.rpm Preparing...

########################################### [100%]

1:MySQL-server-community

########################################### [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 test 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 with the /usr/bin/mysqlbug script!

2.3、安装MySQL客户端

[root@test ~]# rpm -ivh MySQL-client-community-5.1.50-1.rhel4.x86_64.rpm Preparing...

########################################### [100%]

1:MySQL-client-community

########################################### [100%]

2.4、测试MySQL数据库

启动MySQL数据库,命令:service mysql start

MySQL数据库服务器端安装完成即可测试mysql数据是否安装成功,最简单的测试方法为: 在windows下运行telnet访问mysql所在服务器的3306端口(或mysql服务器上netstat –nat查看监听端口),若访问成功,则表明MySQL服务器端成功安装。如:

2.5、初始化MySQL数据库

设置mysql数据库访问密码:

[root@test bin]#cd /usr/bin/

[root@test bin]# mysqladmin -u root -p -h 192.168.0.251 password 'cn' Enter password:

(因为数据库刚安装好密码为空,在上边提示输入密码的地方直接回车即可)。

测试mysql数据库密码设置:

[root@test bin]# mysql -u root -p -h 192.168.0.251

Enter password: ——输入数据库密码cn Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 42

Server version: 5.1.50-community MySQL Community Server (GPL) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test |

| webaudit | +--------------------+ 4 rows in set (0.01 sec)

修改MySQL权限使数据库可以远程访问:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'cn' WITH GRANT OPTION;

Query OK, 0 rows affected (0.01 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec)

清楚Mysql空密码数据库账户:

[root@test ~]# mysql -u root -p -h 192.168.0.251 Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

………….

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 – Database changed mysql> show tables;

mysql> delete from user where password=""; Query OK, 4 rows affected (0.00 sec) mysql> Ctrl-C -- exit!

Bye

使用Navicat测试MySQL远程连接: 打开Navicat工具,添加新的mysql连接:

右键MySQL链接名,选择【打开链接】,入远程访问成功,则出现如下数据库列表。

这样可在此工具中mysql数据库进行管理、备份等所以操作。

稍后MySQL迁移手册所有操作就是通过该工具或SQLyog工具远程连接MySQL数据库进行操作完成的。

三、 MySQL源码编译安装方式

详见附件《MySQL源代码编译安装.docx》 四、 MySQL常用命令

MySQL启动:service mysql start MySQL停止:service mysql stop MySQL重启:service mysql restart 显示数据库:mysql> show databases;

显示数据库中表:mysql> use mysql;

mysql> show tables;

显示数据表的结构:mysql> describe 表名; 建库:mysql> create database 库名; 建表:mysql> use 库名;

mysql> create table 表名 (字段设定列表);

建议: 在数据迁移部署前,特别是远程服务器前一部署,建议先清除原数据库中非必须数据。

MySQL数据库数据迁移主要2种方式: 五、 MySQL迁移部署手册

A、 迁移到原MySQL数据库同局域网的目标MySQL数据库,最简单的方式我们可以通过MySQL

连接工具的数据同步工具实现。

Navicat for MySQL工具【数据同步】,步骤不详述。

SQLyog-MySQL GUI工具【数据库同步向导】,步骤不详述。

B、迁移到原MySQL数据库非同一局域网的MySQL目标数据库,我们采用将原MySQL数据库备5.1、MySQL数据库连接

打开Navicat for MySQL,单击【连接】工具,在弹出的窗口中依次输入数据库链接名如orcl_191.168.0.191,IP、端口、账户、密码,然后点击【确定】。

份成*.sql脚本,再在目标MySQL数据库导入*.sql脚本的方式进行迁移部署;下边详述该迁移方式。

此时,在窗口左边会出现数据库连接项orcl_192.168.0.191,点击orcl_192.168.0.191则弹出数据库

实例列表。现在

5.2、MySQL数据库备份

联通集团WAP系统需要用到数据库webaudit、newaudit(MMS)、idcconfig( …… 此处隐藏:4829字,全部文档内容请下载后查看。喜欢就下载吧 ……

CENTOS 5.2 X64下MySQL安装、Windows下MySQL安装、迁移部署、主.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wenku/1485166.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)