日期:2014-05-16  浏览次数:20613 次

从windows迁移mysql到linux
1. centos,安装mysql
# yum install mysql mysql-server

wget http://mirrors.163.com/centos/5/os/i386/CentOS/mysql-server-5.0.77-4.el5_6.6.i386.rpm

rpm -ivh mysql-server-5.0.77-4.el5_6.6.i386.rpm


2. 开启mysql默认3306端口
vi /etc/sysconfig/iptables

// 增加下面一行
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

/sbin/service iptables restart


3. 开启mysql服务
/sbin/chkconfig mysqld on

/sbin/service mysqld start


4. 查看mysql服务状态
mysqladmin version status


5. passwd root
use mysql;
UPDATE user SET password=PASSWORD("xxxx") WHERE user="root"

/sbin/service mysqld restart


6. add mysql database
create database knet default charset utf8 collate utf8_general_ci;


7. grant privilege
grant all privileges on knet.* to 'admin'@'192.168.1.119' identified by 'admin';

use mysql;
select host,user,password from user;


8. grant developer privileges
grant select,insert,update on knet.* to 'admin'@'%' identified by 'admin'

user mysql;
select * from user;
select * from db;


9. 导入数据
mysql -uadmin -padmin < knet.sql;

参考资料:
http://linux.nuvvo.com/lesson/2867-linux-apache-mysql-and-php-lamp-server-configuration