Jump to content
The Uniform Server Community

UniServer 3.3 How to MySQL Downgrade


Ric
 Share

Recommended Posts

I have mentioned the incompatibility between MySQL 4 and 5 this shows you how to downgrade UniServer 3.3 from MySQL 5 to MySQL 4. The process is relatively simple.

 

1) You need to work on clean copies of UniServer 3.2a and 3.3 download these and save both files into the same folder.

 

2) Unzip both files (no need to specify a folder) into the current folder.

 

3) Within UniServer3_3 rename database folder mysql we need this later.

 

Rename this folder: UniServer3_3/ Uniform Server /diskw/user/local/mysql

To: UniServer3_3/ Uniform Server /diskw/user/local/mysql_old

 

4) From UniServer3_2a copy the mysql folder and all its content to UniServer3_3:

 

Copy this folder: UniServer3_2a/ UniServer3_2a /diskw/user/local/mysql

To: UniServer3_3/ Uniform Server /diskw/user/local/mysql

 

That completes the database installation. MySQL 4 database contains tables for the old phpMyAdmin package these need updating to the new version of phpMyAdmin. Just a matter of deleting the old and replace with the new.

 

5) Delete the old phpMyAdmin folder

 

UniServer3_3/Uniform Server/diskw/user/local/mysql/data/phpMyAdmin

 

6) Copy new phpMyAdmin contained in mysql_old/data into mysql/data

 

Copy folder:

UniServer3_3/Uniform Server/diskw/user/local/mysql_old/data/phpMyAdmin

To:

UniServer3_3/Uniform Server/diskw/user/local/mysql/data

 

7) Delete folder mysql_old that's it run the server and check it out.

 

You can run with this however if you look in the MySQL error log file

UniServer3_3/Uniform Server/diskw/user/local/mysql/data/{your name}.err

 

You will find two warning messages similar to this:

 

060504 21:17:40 [Warning] mysql.user table is not updated to new password format; Disabling new password usage until mysql_fix_privilege_tables is run

060504 21:17:40 [Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live without them

 

They are only warning messages and can be safely ignored unless your programmes use these extra facilities. To resolve the above follow these instructions

 

8) (see note 1) Obtain a file named:

mysql_fix_privilege_tables.sql

 

9) Save this file in the following folder:

UniServer3_3/Uniform Server/diskw/user/local/mysql/bin

 

10) (see note 2) Open NotePad (or any other text editor) copy and past these two lines into it

 

mysql -u root -p mysql --force

pause

 

Save the file as fix_tables.bat it can be named what you like make sure you use .bat and not .txt.

Save or move the file to the following folder:

UniServer3_3/Uniform Server/diskw/user/local/mysql/bin

 

11) Start your server and start MySQL

 

12) Navigate to the batch file fix_tables.bat (using Windows Explorer) run it (double clicking on it name or icon).

 

When requested for a password type in root

 

The batch file will run and update your database. You can safely ignore the errors these are expected (some of the tables exist hence duplication errors are reported and that's whey you cannot use phpMyAdmin and need to use a command line)

 

13) All that remains is to shutdown and restart the servers. Check the error log and test your programs.

 

Note 1: How to obtain the file mysql_fix_privilege_tables.sql

a) You can download it from??? I tried in vain to find a site (sorry).

:( Ask the UniServer development team for it (well they removed it to save space)

c) I must confess the one I used came from a WAMP5 installation.

d) Its only a text file see my reply!!!! Copy and save it using note pad.

 

Note 2: Breakdown of command line

 

mysql --- Database program

-u --- user name

-p --- password (none given forces you to enter one)

mysql --- data base name

--force --- continue even if we get sql errors

 

pause - it allows you to see what happed (forces you to press any key)

 

My personal reason for downgrading I had Zen Cart running on 3.2a with no problems. However, 3.3 refused to play ball because of MySQL 5 after performing the above mod it now works fine. I like 3.3 with the extra bells and whistles. :(

Link to comment
Share on other sites

-- This script converts any old privilege tables to privilege tables suitable

-- for MySQL 4.0.

 

-- You can safely ignore all 'Duplicate column' and 'Unknown column' errors"

-- because these just mean that your tables are already up to date.

-- This script is safe to run even if your tables are already up to date!

 

-- On unix, you should use the mysql_fix_privilege_tables script to execute

-- this sql script.

-- On windows you should do 'mysql --force mysql

 

-- Convert all tables to UTF-8 with binary collation

-- and reset all char columns to correct width

ALTER TABLE user

MODIFY Host char(60) NOT NULL default '',

MODIFY User char(16) NOT NULL default '',

MODIFY Password char(41) NOT NULL default '',

ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;

ALTER TABLE db

MODIFY Host char(60) NOT NULL default '',

MODIFY Db char(64) NOT NULL default '',

MODIFY User char(16) NOT NULL default '',

ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;

ALTER TABLE host

MODIFY Host char(60) NOT NULL default '',

MODIFY Db char(64) NOT NULL default '',

ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;

ALTER TABLE func

ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;

ALTER TABLE columns_priv

MODIFY Host char(60) NOT NULL default '',

MODIFY Db char(64) NOT NULL default '',

MODIFY User char(16) NOT NULL default '',

MODIFY Table_name char(64) NOT NULL default '',

MODIFY Column_name char(64) NOT NULL default '',

ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;

ALTER TABLE tables_priv

MODIFY Host char(60) NOT NULL default '',

MODIFY Db char(64) NOT NULL default '',

MODIFY User char(16) NOT NULL default '',

MODIFY Table_name char(64) NOT NULL default '',

MODIFY Grantor char(77) NOT NULL default '',

ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;

ALTER TABLE user add File_priv enum('N','Y') NOT NULL;

CREATE TABLE IF NOT EXISTS func (

name char(64) binary DEFAULT '' NOT NULL,

ret tinyint(1) DEFAULT '0' NOT NULL,

dl char(128) DEFAULT '' NOT NULL,

type enum ('function','aggregate') NOT NULL,

PRIMARY KEY (name)

) CHARACTER SET utf8 COLLATE utf8_bin;

 

-- Detect whether or not we had the Grant_priv column

SET @hadGrantPriv:=0;

SELECT @hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%';

 

ALTER TABLE user add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;

ALTER TABLE host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;

ALTER TABLE db add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;

 

--- Fix privileges for old tables

UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;

UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;

UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;

 

--

-- The second alter changes ssl_type to new 4.0.2 format

-- Adding columns needed by GRANT .. REQUIRE (openssl)"

 

ALTER TABLE user

ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL,

ADD ssl_cipher BLOB NOT NULL,

ADD x509_issuer BLOB NOT NULL,

ADD x509_subject BLOB NOT NULL;

ALTER TABLE user MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL;

 

--

-- Create tables_priv and columns_priv if they don't exists

--

 

CREATE TABLE IF NOT EXISTS tables_priv (

Host char(60) binary DEFAULT '' NOT NULL,

Db char(64) binary DEFAULT '' NOT NULL,

User char(16) binary DEFAULT '' NOT NULL,

Table_name char(64) binary DEFAULT '' NOT NULL,

Grantor char(77) DEFAULT '' NOT NULL,

Timestamp timestamp(14),

Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,

Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,

PRIMARY KEY (Host,Db,User,Table_name)

) CHARACTER SET utf8 COLLATE utf8_bin;

 

CREATE TABLE IF NOT EXISTS columns_priv (

Host char(60) DEFAULT '' NOT NULL,

Db char(60) DEFAULT '' NOT NULL,

User char(16) DEFAULT '' NOT NULL,

Table_name char(60) DEFAULT '' NOT NULL,

Column_name char(59) DEFAULT '' NOT NULL,

Timestamp timestamp(14),

Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,

PRIMARY KEY (Host,Db,User,Table_name,Column_name)

) CHARACTER SET utf8 COLLATE utf8_bin;

 

 

--

-- Name change of Type -> Column_priv from MySQL 3.22.12

--

 

ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL;

 

--

-- Add the new 'type' column to the func table.

--

 

ALTER TABLE func add type enum ('function','aggregate') NOT NULL;

 

--

-- Change the user,db and host tables to MySQL 4.0 format

--

 

# Detect whether we had Show_db_priv

SET @hadShowDbPriv:=0;

SELECT @hadShowDbPriv:=1 FROM user WHERE Show_db_priv LIKE '%';

 

ALTER TABLE user

ADD Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Alter_priv,

ADD Super_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_db_priv,

ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Super_priv,

ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv,

ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv,

ADD Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv,

ADD Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv;

 

-- Convert privileges so that users have similar privileges as before

 

UPDATE user SET Show_db_priv= Select_priv, Super_priv=Process_priv, Execute_priv=Process_priv, Create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=File_priv where user"" AND @hadShowDbPriv = 0;

 

 

-- Add fields that can be used to limit number of questions and connections

-- for some users.

 

ALTER TABLE user

ADD max_questions int(11) NOT NULL AFTER x509_subject,

ADD max_updates int(11) unsigned NOT NULL AFTER max_questions,

ADD max_connections int(11) unsigned NOT NULL AFTER max_updates;

 

 

--

-- Add Create_tmp_table_priv and Lock_tables_priv to db and host

--

 

ALTER TABLE db

ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,

ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;

ALTER TABLE host

ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,

ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;

 

alter table db change Db Db char(64) binary DEFAULT '' NOT NULL;

alter table host change Db Db char(64) binary DEFAULT '' NOT NULL;

alter table user change max_questions max_questions int(11) unsigned DEFAULT 0 NOT NULL;

alter table tables_priv change Db Db char(64) binary DEFAULT '' NOT NULL, change Host Host char(60) binary DEFAULT '' NOT NULL, change User User char(16) binary DEFAULT '' NOT NULL, change Table_name Table_name char(64) binary DEFAULT '' NOT NULL;

alter table tables_priv add KEY Grantor (Grantor);

alter table columns_priv change Db Db char(64) binary DEFAULT '' NOT NULL, change Host Host char(60) binary DEFAULT '' NOT NULL, change User User char(16) binary DEFAULT '' NOT NULL, change Table_name Table_name char(64) binary DEFAULT '' NOT NULL, change Column_name Column_name char(64) binary DEFAULT '' NOT NULL;

 

alter table db comment='Database privileges';

alter table host comment='Host privileges; Merged with database privileges';

alter table user comment='Users and global privileges';

alter table func comment='User defined functions';

alter table tables_priv comment='Table privileges';

alter table columns_priv comment='Column privileges';

 

#

# Create some possible missing tables

#

CREATE TABLE IF NOT EXISTS help_topic (

help_topic_id int unsigned not null,

name varchar(64) not null,

help_category_id smallint unsigned not null,

description text not null,

example text not null,

url varchar(128) not null,

primary key (help_topic_id), unique index (name)

) CHARACTER SET utf8 comment='help topics';

 

CREATE TABLE IF NOT EXISTS help_category (

help_category_id smallint unsigned not null,

name varchar(64) not null,

parent_category_id smallint unsigned null,

url varchar(128) not null,

primary key (help_category_id),

unique index (name)

) CHARACTER SET utf8 comment='help categories';

 

CREATE TABLE IF NOT EXISTS help_relation (

help_topic_id int unsigned not null references help_topic,

help_keyword_id int unsigned not null references help_keyword,

primary key (help_keyword_id, help_topic_id)

) CHARACTER SET utf8 comment='keyword-topic relation';

 

CREATE TABLE IF NOT EXISTS help_keyword (

help_keyword_id int unsigned not null,

name varchar(64) not null,

primary key (help_keyword_id),

unique index (name)

) CHARACTER SET utf8 comment='help keywords';

 

#

# Create missing time zone related tables

#

 

CREATE TABLE IF NOT EXISTS time_zone_name (

Name char(64) NOT NULL,

Time_zone_id int unsigned NOT NULL,

PRIMARY KEY Name (Name)

) CHARACTER SET utf8 comment='Time zone names';

 

CREATE TABLE IF NOT EXISTS time_zone (

Time_zone_id int unsigned NOT NULL auto_increment,

Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,

PRIMARY KEY TzId (Time_zone_id)

) CHARACTER SET utf8 comment='Time zones';

 

CREATE TABLE IF NOT EXISTS time_zone_transition (

Time_zone_id int unsigned NOT NULL,

Transition_time bigint signed NOT NULL,

Transition_type_id int unsigned NOT NULL,

PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)

) CHARACTER SET utf8 comment='Time zone transitions';

 

CREATE TABLE IF NOT EXISTS time_zone_transition_type (

Time_zone_id int unsigned NOT NULL,

Transition_type_id int unsigned NOT NULL,

Offset int signed DEFAULT 0 NOT NULL,

Is_DST tinyint unsigned DEFAULT 0 NOT NULL,

Abbreviation char(8) DEFAULT '' NOT NULL,

PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)

) CHARACTER SET utf8 comment='Time zone transition types';

 

CREATE TABLE IF NOT EXISTS time_zone_leap_second (

Transition_time bigint signed NOT NULL,

Correction int signed NOT NULL,

PRIMARY KEY TranTime (Transition_time)

) CHARACTER SET utf8 comment='Leap seconds information for time zones';

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...