大鸟的学习乐园
路漫漫其修远兮,吾将上下而求索
posts - 26,comments - 27,trackbacks - 0

h1. MySQL5.1.53编译,安装配置

 

Debian4下安装MySql5.1.53

 

h2. 编译

 

<pre>

./configure  '--prefix=/usr/local/mysql5.1.53' '--with-mysqld-user=mysql' '--with-extra-charsets=all' '--with-unix-socket-path=/usr/local/mysql5.1.53/var/mysql.sock' '--with-named-curses-libs=/lib/libncurses.so.5' '--enable-assembler'

</pre>

 

h2. 安装

 

<pre>

make && make install

</pre>

 

h2. 初始化数据库

 

刚刚编译安装完成的mysql中没有任何数据库,包括默认的mysql数据库,这个需要初始化安装。

命令如下

<pre>

/usr/local/mysql5.1.53/bin/mysql_install_db

</pre>

 

h2. 配置

 

h3. 创建配置文件

 

我们把/usr/local/mysql5.1.53/share/mysql这个目录下的my-medium.cnf,复制为my.cnf到mysql安装目录

做如下修改

在[mysqld] 配置块中加入

skip-name-resolve #取消DNS反向解析,提高远程访问速度

_详细内容,参考57上的my.cnf吧_

 

h3. 启动&停止

 

* 启动

<pre>

/usr/local/mysql5.1.53/bin/mysqld_safe --user=root &

</pre>

* 停止

<pre>

/usr/local/mysql5.1.53/share/mysql/mysql.server stop

</pre>

 

h3. 进入mysql命令行

 

<pre>

/usr/local/mysql5.1.53/bin/mysql -uroot

</pre>

 

h3. 开启远程访问

 

# 配置cnf文件

找到你的my.cnf文件(如果用debian提供的mysql,在/etc/mysql/my.cnf)

查找 bind-address,等号后边写server的IP地址

# 在mysql命令行执行下列命令

<pre>

GRANT ALL PRIVILEGES ON *.* TO 'depman'@'%' IDENTIFIED BY 'depman' WITH GRANT OPTION;

</pre>

说明 : 添加depman用户,密码为depman,可以在任何远程机器访问数据库且拥有全部权限

 

h3. 添加InnoDB支持

 

# 进入mysql命令行

# mysql> show plugin;

查看是否有InnoDB的支持,没有的话

# mysql> install plugin innodb soname "ha_innodb.so";

# 再次执行mysql> show plugin;发现有InnoDB,安装成功

 

h3. 数据移植

 

* 备份57上的kebin数据库(sql文件)

<pre>

/usr/local/mysql5.1.53/bin/mysqldump --skip-lock-tables -h192.168.12.57 -uroot -proot kebin > kebin.sql

</pre>

* 导入刚才生成的sql文件到kebin数据库

<pre>

/usr/local/mysql5.1.53/bin/mysql kebin < kebin.sql

</pre>

* 从ServerA到ServerB迁移数据

<pre>

/usr/local/mysql5.1.53/bin/mysqldump --skip-lock-tables -uroot -proot kebin | /usr/local/mysql5.1.53/bin/mysql -h192.168.12.58 -udepman -pdepman kebin

</pre>

posted on 2012-01-25 19:38 大鸟 阅读(441) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: