I've a table with composite primary key with below structure:
CREATE TABLE field_name_test (
id_type varchar(128) NOT NULL DEFAULT '',
desc varchar(128) NOT NULL DEFAULT '' ,
deleted tinyint(4) NOT NULL DEFAULT '0' ,
type_id int(10) unsigned NOT NULL ,
rev_id int(10) unsigned NOT NULL ,
lang varchar(32) NOT NULL DEFAULT '',
delta int(10) unsigned NOT NULL,
fname_value varchar(255) DEFAULT NULL,
fname_format varchar(255) DEFAULT NULL,
PRIMARY KEY (id_type,type_id,rev_id,deleted,delta,lang),
KEY id_type (id_type),
KEY desc (desc),
KEY deleted (deleted),
KEY type_id (type_id),
KEY rev_id (rev_id),
KEY lang (lang),
KEY fname_format (fname_format)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
i'm running pt-o-s-c to change the collation of the table and it is working fine with other tables but this one is giving below error:
pt-online-schema-change --execute --password=#### --user=#### --socket=#### --port=#### --chunk-time=1 --recursion-method=none --no-drop-old-table --alter "CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci , CHANGE desc desc varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci , CHANGE id_type id_type varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci , CHANGE lang lang varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci , ROW_FORMAT=DYNAMIC , LOCK=SHARED, ALGORITHM=COPY" D=db,t=field_name_test,h=localhost
No slaves found. See --recursion-method if host ###### has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
Operation, tries, wait:
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_foreign_keys, 10, 1
Altering db.field_name_test...
Creating new table...
Created new table db._field_name_test_new OK.
Altering new table...
Altered db._field_name_test_new OK.
2017-09-15T09:18:47 Creating triggers...
2017-09-15T09:18:47 Created triggers OK.
2017-09-15T09:18:47 Copying approximately 3843064 rows...
2017-09-15T09:18:47 Dropping triggers...
2017-09-15T09:18:47 Dropped triggers OK.
2017-09-15T09:18:47 Dropping new table...
2017-09-15T09:18:47 Dropped new table OK.
db.field_name_test was not altered.
2017-09-15T09:18:47 Error copying rows from db.field_name_test to db._field_name_test_new: 2017-09-15T09:18:47 Error copying rows at chunk 1 of db.field_name_test because MySQL used only 390 bytes of the PRIMARY index instead of 497. See the --[no]check-plan documentation for more information.
I'm running above in Galera 3 node cluster.
So i've below concerns on pt-o-s-c:
1) what solutions can be for above such cases ?
2) Is it possible to run parallel pt-o-s-c in a same database ?
Please let me know if any other input you need. Thanks in advance.
I have pushed my joomla website content to bigrock serverto host the website. But i am getting the error while hitting the url of website.
Below is the error:
Error displaying the error page: Application Instantiation Error: Table 'resoninr_jooml29.resoninr_session' doesn't exist SQL=SELECT session_id FROM resoninr_session WHERE session_id = 'gqcktvtop2kv33lc28ikjrhi44' LIMIT 0, 1
I am new to joomla and database. Can anybody please help me out to resolve the issue.
Thanks in advance.
if you have all table prefix in the db is "jos83" then replace the value of "$dbprefix" variable with the same prefix as in db("jos83") in the configuration.php at the root of joomla site.
It depends how you have transferred the files and database. Through Akeeba or any third party extension or manually. If you transferred manually then there is less chance of change in public $dbprefix = 'jos83_'; present in configuration file, as you need to change just the database user, database name and hostname in configuration.php file.
Suppose you did through Akeeba then it will ask for a new prefix during site restoration. Suppose you did through Akeeba and still it doesnt work then your session table may be damaged. And if session table is damaged Joomla wont load. You have to manully delete the table and recreate it in phpmyadmin using this sql command
DROP TABLE IF EXISTS `resoninr_session`;
CREATE TABLE IF NOT EXISTS `resoninr_session` (
`username` varchar(150) default '',
`time` varchar(14) default '',
`session_id` varchar(200) NOT NULL default '0',
`guest` tinyint(4) default '1',
`userid` int(11) default '0',
`usertype` varchar(50) default '',
`gid` tinyint(3) unsigned NOT NULL default '0',
`client_id` tinyint(3) unsigned NOT NULL default '0',
`data` longtext,
PRIMARY KEY (`session_id`(64)),
KEY `whosonline` (`guest`,`usertype`),
KEY `userid` (`userid`),
KEY `time` (`time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Some helpful links
http://forum.joomla.org/viewtopic.php?t=362525
why does joomla 2.5 session table corrupt?
https://www.ostraining.com/blog/joomla/joomla-session-crashed/
I am trying to alter one of my InnoDB tables.
This is query:
ALTER TABLE `tf5h_assets`
ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `idx_asset_name` (`name`), ADD KEY `idx_lft_rgt` (`lft`,`rgt`), ADD KEY `idx_parent_id` (`parent_id`);
Error is:
#1114 - The table 'tf5h_assets' is full
I do not undesrtand how is it "full" when it's empty table i created from MySQL dump (structure, no data) file.
What's wierd is that i can alter it like this:
ALTER TABLE `tf5h_assets`
ADD PRIMARY KEY (`id`);
ALTER TABLE `tf5h_assets`
ADD UNIQUE KEY `idx_asset_name` (`name`);
ALTER TABLE `tf5h_assets`
ADD KEY `idx_lft_rgt` (`lft`,`rgt`);
ALTER TABLE `tf5h_assets`
ADD KEY `idx_parent_id` (`parent_id`);
and it does not throw that error.
What am i doing wrong?
This ALTER TABLE statements are from structure mysql dump file. Is there a way to split em like i did somehow when structure is exported so i dont have to do it manually?
I googles "table is full" error and this is what i did so far:
1) Checked for disk space - 80+ gigs of free space
2) Added to my.cnf :
innodb_file_per_table = 1
innodb_file_format = barracuda
and rebooted mysql server and created fresh db.
EDIT:
I solved my problem but i have no idea how to solve it for databases that i will not be able to export from Joomla.
Thing is, phpmyadmin is separating table creation from key creation like this:
CREATE TABLE IF NOT EXISTS `tf5h_assets` (
`id` int(10) unsigned NOT NULL COMMENT 'Primary Key',
`parent_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Nested set parent.',
`lft` int(11) NOT NULL DEFAULT '0' COMMENT 'Nested set lft.',
`rgt` int(11) NOT NULL DEFAULT '0' COMMENT 'Nested set rgt.',
`level` int(10) unsigned NOT NULL COMMENT 'The cached level in the nested tree.',
`name` varchar(50) NOT NULL COMMENT 'The unique name for the asset.\n',
`title` varchar(100) NOT NULL COMMENT 'The descriptive title for the asset.',
`rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=382 ;
and than later on:
ALTER TABLE `tf5h_assets`
ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `idx_asset_name` (`name`), ADD KEY `idx_lft_rgt` (`lft`,`rgt`), ADD KEY `idx_parent_id` (`parent_id`);
and later on:
ALTER TABLE `tf5h_assets`
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary Key',AUTO_INCREMENT=382;
I managed to get my database up and running by using Joomla's backup / restore component (It's Joomla site). I opened up MySQL dump that component created and this is what i found in there:
CREATE TABLE `#__assets`
(`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary Key',
`parent_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Nested set parent.',
`lft` int(11) NOT NULL DEFAULT '0' COMMENT 'Nested set lft.',
`rgt` int(11) NOT NULL DEFAULT '0' COMMENT 'Nested set rgt.',
`level` int(10) unsigned NOT NULL COMMENT 'The cached level in the nested tree.',
`name` varchar(50) NOT NULL COMMENT 'The unique name for the asset.\n',
`title` varchar(100) NOT NULL COMMENT 'The descriptive title for the asset.',
`rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_asset_name` (`name`),
KEY `idx_lft_rgt` (`lft`,`rgt`),
KEY `idx_parent_id` (`parent_id`) )
ENGINE=InnoDB AUTO_INCREMENT=382 DEFAULT CHARSET=utf8;
Whole process is executed in one run, and it works fine.
Now, i have luck it's Joomla database. But what will i do when database wont be Joomla's? I have no idea. Is there a way to change how phpmyadmin stores dump? Would terminal access to mysql create different mysql dump that would create database in one go instead of using "ALTER"?
Ok so i still don't know what creates this problem except that it has something to do with how phpmyadmin exports databases and reimports them again.
And as i assumed in my original post that i will run into this problem with database that can not be exported trough Joomla component sooner or later, it happened...well...sooner.
Anyway, if you have console access to your mysql server you can deal with this by simply mysql dumping:
mysqldump -p NameOfDatabase > NameOfDumpFile.sql
Download dump file from server and you can import it trough phpmyadmin. It works like a charm. mysqldump creates databases in one query so there is no problem with assigning keys etc.
this is more like a how-to question about csv, excel, mysql files than a standard coding question. However I really would appreciat some help with this.
I have this predefined CSV format, that I need in order to import it to a database with Sequel Pro.
ID,"user_login","user_pass","user_nicename","user_email","user_url","user_registered","user_activation_key",user_status,"display_name"
1,"some_name","$P$BDMmGci3KAqNQwfPtgzfQTp8D3k7bC.","some_name","some.name#gmx.net","","2013-06-27 11:32:08","",0,"Some Name"
On the other hand I have an old database file looking like this …
CREATE TABLE `ezxsubscription` (
`id` int(11) NOT NULL auto_increment,
`version_status` int(11) NOT NULL default '0',
`subscriptionlist_id` int(11) default '0',
`email` varchar(255) default '',
`hash` varchar(255) default '',
`status` int(11) default '0',
`vip` int(11) default '0',
`last_active` int(11) NOT NULL default '0',
`output_format` varchar(255) default '',
`creator_id` int(11) NOT NULL default '0',
`created` int(11) NOT NULL default '0',
`confirmed` int(11) NOT NULL default '0',
`approved` int(11) NOT NULL default '0',
`removed` int(11) NOT NULL default '0',
`user_id` int(11) default '0',
`bounce_count` int(11) default '0',
PRIMARY KEY (`id`,`version_status`)
) TYPE=MyISAM;
--
-- Dumping data for table `ezxsubscription`
--
INSERT INTO `ezxsubscription` VALUES (454,1,5,'name#surname.com','31b6bde64e1282ba82d7d0c8ad6ebaa9',2,0,0,'2',1127,1142840848,0,1142840868,0,2633,0);
INSERT INTO `ezxsubscription` VALUES (1,1,5,'name.name#gmail.com','fff4b8d75ecdfad43ed8c89444939cfb',2,0,0,'2',10,1141956489,1141956489,1141956489,0,14,0);
…
The database has like 400 users in it that I couldn't sort by hand. I need to have the database file to be in the format of the predefined CSV above. Where the email-address should be the user_login and user_name. The rest of the old database like approved, removed or whatever can simply be disregarded. It's just about the user-login and the passwords.
Any clever idea on how to do so? The aim is to import all the old users of the old database to the new database (based on Wordpress).
I would really appreciate some tips or tricks.
Thank you in advance.
Matt
Update:
This is the old format of the ezxsubscription table.
"id","version_status","subscriptionlist_id","email","hash","status","vip","last_active","output_format","creator_id","created","confirmed","approved","removed","user_id","bounce_count"
1,1,5,"andreas#gmail.at","fff4b8d75ecdfad43ed8c89444939cfb",2,0,0,2,10,1141956489,1141956489,1141956489,0,14,0
All I wanna do now is convert this users to the new wordpress format:
"ID","user_login","user_pass","user_nicename","user_email","user_url","user_registered","user_activation_key","user_status","display_name"
1,"local","$P$BCf7QHr3rsp0YNZd7eMfYgncRZmR6j0","local","temp#local.dev","","2013-03-14 18:46:29","",0,"local"
I do even have problems understanding what the hash in the old db means.
All I wanna do is copy all existing old users to the new wordpress database so that I have the e-mail addresses and the passwords, so that they are able to login again.
So I want to make the old email the username of the new wordpress db. And the hash should probably be the new user_pass in wordpress. However I only hope that the hash is the password of the current login — I don't even know for sure.
Kind Regards,
Matt
Use SELECT ... INTO OUTFILE syntax to create a CSV file from your old table with a query like this
SELECT *
INTO OUTFILE '/path/to/your/file.csv'
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM
(
SELECT 'id', 'user_login', 'user_pass', 'user_nicename','user_email','user_url','user_registered','user_activation_key','user_status','display_name'
UNION ALL
SELECT id, email, hash, SUBSTRING_INDEX(email, '#', 1), email, '', created, '', status, SUBSTRING_INDEX(email, '#', 1)
FROM ezxsubscription
) q
Content of the created file:
"id","user_login","user_pass","user_nicename","user_email","user_url","user_registered","user_activation_key","user_status","display_name"
"454","name#surname.com","31b6bde64e1282ba82d7d0c8ad6ebaa9","name","name#surname.com","","1142840848","","2","name"
"1","name.name#gmail.com","fff4b8d75ecdfad43ed8c89444939cfb","name.name","name.name#gmail.com","","1141956489","","2","name.name"