Moving MySql from windows server to linux -
moving old win2003 server new vm server (our choice win or linux) if go linux there problems converting current tables?
moving mysql/windows same version of mysql/linux
you can mysqldump databases follows:
c:\> mysqldump -uroot -p --routines --triggers --flush-privileges --all-databases > mysqldata.sql
move mysqldata.sql
linux box , run reload
mysql -uroot -p < mysqldata.sql
moving mysql/windows higher version of mysql/linux
you can mysqldump databases except mysql schema !!! why?
- mysql has grants user in main table called
mysql.user
. - for each major release of mysql,
mysql.user
has following number of columns:- 43 columns in mysql 5.6
- 42 columns in mysql 5.5
- 39 columns in mysql 5.1
- 37 columns in mysql 5.0
- 31 columns in mysql 4.0/4.1
- i have discussed
mysql.user
's column arrangement beforemay 01, 2013
: can find out version of mysql data files?dec 24, 2012
: backup , restore "mysql" databasejun 13, 2012
: fastest way move database 1 server anotherfeb 08, 2012
: will replication 5.5.20 5.0.xx server work?
here windows batch script mysqldump databases except mysql schema , dump mysql schema in pure sql:
rem rem startup settings rem set mysql_conn=-uroot -prootpassword set mysqldump_output=c:\localdump.sql set mysql_usergrants=c:\localgrants.sql set mysql_tempgrants=c:\tempgrants.sql rem rem mysql user data rem set mysqldump_options=--routines --triggers --databases set sqlstmt=select concat('mysqldump %mysql_conn% %mysqldump_options% ',dblist) set sqlstmt=%sqlstmt% (select group_concat(schema_name separator ' ') dblist set sqlstmt=%sqlstmt% information_schema.schemata schema_name not in set sqlstmt=%sqlstmt% ('information_schema','mysql','performance_schema')) echo echo off > c:\runlocaldump.bat mysql %mysql_conn% -ane"%sqlstmt%" >> c:\runlocaldump.bat c:\runlocaldump.bat > %mysqldump_output% rem rem mysql user grants rem set sqlstmt=select concat('show grants ''',user,'''@''',host,''';') set sqlstmt=%sqlstmt% mysql.user length(user) echo %sqlstmt% mysql %mysql_conn% -ane"%sqlstmt%" > %mysql_tempgrants% mysql %mysql_conn% -an < %mysql_tempgrants% > %mysql_usergrants% del %mysql_tempgrants%
once create mysqldump , grants file, copy them linux server execute them locally. execute mysqldump first. then, load grants.
Comments
Post a Comment