免费资源分享交流---QQ群116393

小马资源

当前位置: 首页 > 企业网管 >

实战mysql的安装与复制 - yahoon的小屋

时间:2012-10-19 23:37来源:yahoon.blog.51cto.com 作者:admin 点击:
实战mysql的安装与复制此文是对前文的一次扩展和补充.增加了很多内容以及过程中遇到问题的解决办法.当前已经有一台linux(均为redhat)服务器,ip10.1.3.106运行mysql4.1.9,现在需要构建一个mysql的复制..
实战mysql的安装与复制
 
此文是对前文的一次扩展和补充.增加了很多内容以及过程中遇到问题的解决办法.
 
当前已经有一台linux(均为redhat)服务器,ip10.1.3.106运行mysql4.1.9,现在需要构建一个mysql的复制系统,当前的106作为主服务器,另外需要搭建一台复制服务器做从服务器.新服务器的ip10.1.3.107
 
1.安装mysql
安装包为mysql-4.1.9.tar.gz(为了保证兼容性,采用的是与106相同的安装包)
按照安装文档的方法,按照如下顺序进行安装
The basic commands you must execute to install a MySQL source
distribution are:
增加用户
     shell> groupadd mysql
     shell> useradd -g mysql mysql
     shell> tar –zxvf mysql-4.1.9.tar.gz
     shell> cd mysql-4.1.9
编译安装,安装路径为/usr/local/mysql
     shell> ./configure --prefix=/usr/local/mysql
     shell> make
     shell> make install
     shell> cp support-files/my-medium.cnf /etc/my.cnf
     shell> cd /usr/local/mysql
安装初始的表
     shell> bin/mysql_install_db --user=mysql
信息如下
[root@localhost mysql]# bin/mysql_install_db --user=mysql
Installing all prepared tables
Fill help tables
 
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
 
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h 机器名password 'new-password'
See the manual for more instructions.
 
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
 
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
 
Please report any problems with the /usr/local/mysql/bin/mysqlbug script!
 
The latest information about MySQL is available on the web at
[url]http://www.mysql.com[/url]
Support MySQL by buying support/licenses at [url]https://order.mysql.com[/url]
更改权限
     shell> chown -R root  .
     shell> chown -R mysql var
     shell> chgrp -R mysql .
启动服务
     shell> bin/mysqld_safe --user=mysql & 
信息如下
[root@localhost mysql]# bin/mysqld_safe --user=mysql &
[1] 25772
[root@localhost mysql]# Starting mysqld daemon with databases from /usr/local/mysql/var
 
修改MYSQL密码,默认安装密码为空,为了安全你必须马上为root设置密码例如设为abc
/usr/local/mysql/bin/mysqladmin -u root password abc
 
通过命令行登陆
/usr/local/mysql/bin/mysql –uroot –p
按提示输入密码即可
 
让它随系统启动时自动启动,/etc/rc.d/rc.local中加入以下一行
/usr/local/mysql/bin/mysqld_safe --user=mysql &
 
停止mysql
/usr/local/mysql/bin/mysqladmin -uroot -p shutdown
按提示输入密码即可
 
这样mysql的安装就完成了.
 
(责任编辑:IT路路通)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发布者资料
IT路路通 查看详细资料 发送留言 加为好友 用户等级:月费会员 注册时间:2012-10-18 20:10 最后登录:2012-11-24 10:11
栏目列表
手机充值
推荐内容
淘宝商品
相关文章
IT工具