moodle 迁移

1. 首先安装mysql

sudo apt-get install mysql-server
sudo apt-get install mysql-workbench

2. 导入数据(dump)

用source 命令
进入mysql     mysql -u root -p  
mysql>use 数据库
然后使用source命令,后面参数为脚本文件(如这里用到的.sql)
mysql>source /mysqlbackup/boss_db.sql

3. 配置mysql

/etc/mysql/ 主要配置文件所在位置 my.cnf
root@ubuntu:/home/rgc# gedit /etc/mysql/my.cnf

老的版本中

>skip-networking => # skip-networking

新的版本中

>bind-address=127.0.0.1 => #bind-address= 你机器的IP

这样就可以允许其他机器访问MySQL了

/var/lib/mysql/ 放置的是数据库表文件夹,这里的mysql相当于windows下mysql的data文件夹
debian-5.0.flag ib_logfile0 mysql               openmeetings
ibdata1          ib_logfile1 mysql_upgrade_info xoops

4. 添加用户

例如:
mysql>grant select,insert,update,delete,create,drop on vtdc.employee to joe@10.163.225.87 identified by '123';
给来自10.163.225.87的用户joe分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等操作的权限,并设定口令为123。

mysql>grant all privileges on vtdc.* to joe@10.163.225.87 identified by '123';
给来自10.163.225.87的用户joe分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为123。

mysql>grant all privileges on *.* to joe@10.163.225.87 identified by '123';
给来自10.163.225.87的用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。

mysql>grant all privileges on *.* to joe@localhost identified by '123';
给本机用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。

 

ref:

http://www.linuxidc.com/Linux/2008-01/10699.htm

http://hbzylm.blog.51cto.com/613851/830702

posted @ 2013-05-02 22:31  feiling  阅读(344)  评论(0编辑  收藏  举报