passwords changing on export/import of database - mysql

I have a linux shared hosting with phpmyadmin and MySQL
I run a wamp server without any amends. MOstly it works fine.
However when I export out a database from the wamp and then export it into the Linux the passwords change and I have to go in and reset them.
What's going on please?
--
-- Table structure for table `pfd8x_users`
--
CREATE TABLE IF NOT EXISTS `pfd8x_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
`username` varchar(150) NOT NULL DEFAULT '',
`email` varchar(100) NOT NULL DEFAULT '',
`password` varchar(100) NOT NULL DEFAULT '',
`block` tinyint(4) NOT NULL DEFAULT '0',
`sendEmail` tinyint(4) DEFAULT '0',
`registerDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`lastvisitDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`activation` varchar(100) NOT NULL DEFAULT '',
`params` text NOT NULL,
`lastResetTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Date of last password reset',
`resetCount` int(11) NOT NULL DEFAULT '0' COMMENT 'Count of password resets since lastResetTime',
`otpKey` varchar(1000) NOT NULL DEFAULT '' COMMENT 'Two factor authentication encrypted keys',
`otep` varchar(1000) NOT NULL DEFAULT '' COMMENT 'One time emergency passwords',
PRIMARY KEY (`id`),
KEY `idx_name` (`name`),
KEY `idx_block` (`block`),
KEY `username` (`username`),
KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=401 ;
--
-- Dumping data for table `pfd8x_users`
--
INSERT INTO `pfd8x_users` (`id`, `name`, `username`, `email`, `password`, `block`, `sendEmail`, `registerDate`, `lastvisitDate`, `activation`, `params`, `lastResetTime`, `resetCount`, `otpKey`, `otep`) VALUES
(400, 'Super User', 'NAME', 'fred#email.com', '$P$D5YNEQ62cnGZy0cFTL/x49uBSkdWU80', 0, 1, '2014-04-01 14:59:48', '2014-05-01 16:49:46', '0', '{"admin_style":"","admin_language":"","language":"","editor":"","helpsite":"","timezone":""}', '0000-00-00 00:00:00', 0, '', '');
-- --------------------------------------------------------

Related

MariaDB - CONNECT ENGINE - ORDER BY error

I'm trying to get Asterisk CDR records from MySQL table (5.5.45) by CONNECT engine on other server running MariaDB (10.0.29).
I can create the connection between table easily:
CREATE TABLE `calls` engine=CONNECT table_type=MYSQL
CONNECTION='mysql://user#IP/asteriskcdrdb/calls';
When I run simple SELECT * FROM calls, everything works good, when I add some WHERE conditions, still everything okay.
But the problem start when I add ORDER BY column parameter, then I got this error from MariaDB:
#1032 - Can't find record in 'calls'
I checked MySQL log, MariaDB log - there are no errors at all.
Did I miss something?
Thank you!
Update: The whole query is simple:
SELECT * FROM `calls` ORDER BY `calldate`
The table structure:
CREATE TABLE `calls` (
`calldate` datetime NOT NULL default '0000-00-00 00:00:00',
`clid` varchar(80) NOT NULL default '',
`src` varchar(80) NOT NULL default '',
`dst` varchar(80) NOT NULL default '',
`dcontext` varchar(80) NOT NULL default '',
`channel` varchar(80) NOT NULL default '',
`dstchannel` varchar(80) NOT NULL default '',
`lastapp` varchar(80) NOT NULL default '',
`lastdata` varchar(80) NOT NULL default '',
`duration` int(11) NOT NULL default '0',
`billsec` int(11) NOT NULL default '0',
`disposition` varchar(45) NOT NULL default '',
`amaflags` int(11) NOT NULL default '0',
`accountcode` varchar(20) NOT NULL default '',
`uniqueid` varchar(32) NOT NULL default '',
`userfield` varchar(255) NOT NULL default '',
`recordingfile` varchar(255) NOT NULL default '',
`cnum` varchar(40) NOT NULL default '',
`cnam` varchar(40) NOT NULL default '',
`outbound_cnum` varchar(40) NOT NULL default '',
`outbound_cnam` varchar(40) NOT NULL default '',
`dst_cnam` varchar(40) NOT NULL default '',
`call_charge` float NOT NULL default '0',
`from_did` varchar(30) NOT NULL,
`did` varchar(50) NOT NULL default '',
`user_id` int(8) unsigned default NULL,
`client_id` int(8) unsigned default NULL,
KEY `IDX_UNIQUEID` (`uniqueid`),
KEY `src` (`src`),
KEY `dst` (`dst`),
KEY `calldate` (`calldate`),
KEY `uniqueid` (`uniqueid`),
KEY `userfield` (`userfield`),
KEY `from_did` (`from_did`),
KEY `user_id` (`user_id`),
KEY `client_id` (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Update #2: Update the table names, to don't confuse, but it's not the issue. The CONNECTION table is created okay.
Query works:
SELECT * FROM `calls`
Query works:
SELECT * FROM `calls` WHERE `user_id`=X
Query return error:
SELECT * FROM `calls` ORDER BY `calldate`
Update #3: The MySQL was updated to veriosn 5.5.45, the type was changed to InnoDB and the charset was converted to UTF8. But no success.
PROBLEM SOLVED
Well, it's MariaDB bug, when I changed to FederatedX engine (which is basically little bit limited version of CONNECT), everything works as expected.
In your query you do
SELECT * FROM calls
but in your table structure you have
CREATE TABLE cdr
and both have calldate column. Check if you querying the right table.

Data too long for column 'Subscribe_Specialty' at row 1 - Mysql error

Here is the insert statement -
INSERT INTO `Newsletter_Subscriber_Uploaded_Data`(`File_Id`, `First_Name`, `Last_Name`, `Email`,`Country`,`Country_Id`,`Subscribe_Specialty`,Is_Valid, `Subscription_Id`, `User_Id`, `Created_Date`)
VALUES (2, 'Adolphus','Bonar', 'a.bonar#endocrinology.org', 'United States','2', 'General Practice/Family Medicine', 1 ,20, '89',CURRENT_TIMESTAMP)
For column Subscribe_Specialty, the value I'm trying to insert is 'General Practice/Family Medicine' which has only 32 characters, but still it is giving me the above error.
Please help me guys, as this is a production error.
More Information:
Collation : utf8
Storage Engine : InnoDB
Below is the Table structure -
CREATE TABLE `Newsletter_Subscriber_Uploaded_Data` (
`File_Id` int(11) NOT NULL,
`Row_Id` int(11) NOT NULL AUTO_INCREMENT,
`First_Name` varchar(50) NOT NULL,
`Last_Name` varchar(50) NOT NULL,
`Email` varchar(100) DEFAULT NULL,
`Country` varchar(20) NOT NULL,
`Country_Id` int(11) NOT NULL DEFAULT '0',
`Subscribe_Specialty` varchar(100) NOT NULL,
`Is_Valid` tinyint(4) DEFAULT '0',
`Subscription_Id` int(100) NOT NULL DEFAULT '0',
`Duplicate` tinyint(4) DEFAULT '0',
`Subscriber` tinyint(4) DEFAULT '0',
`Created_Date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`User_Id` int(11) NOT NULL COMMENT 'Panel user id',
PRIMARY KEY (`Row_Id`),
KEY `File_Id` (`File_Id`)
) ENGINE=InnoDB AUTO_INCREMENT=21511 DEFAULT CHARSET=utf8;

#1054-Unknown column 'userid' in 'field list' in mysql. Getting error when i am importing a file containing this table in mysql through xampp

CREATE TABLE IF NOT EXISTS `user` (
`userid` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(100) NOT NULL DEFAULT '',
`password` varchar(100) NOT NULL DEFAULT '',
`authtype` varchar(20) NOT NULL DEFAULT 'mysql',
`disabled` int(1) NOT NULL DEFAULT '0',
`logonchange` int(1) NOT NULL DEFAULT '0',
`expiry` tinyint(1) NOT NULL DEFAULT '0',
`ldapdn` varchar(250) DEFAULT NULL,
`cookieid` varchar(32) DEFAULT NULL,
`lastchanged` int(11) DEFAULT '0',
`first_name` varchar(250) DEFAULT NULL,
`last_name` varchar(250) DEFAULT NULL,
`email` varchar(250) DEFAULT NULL,
`payroll_number` varchar(50) NOT NULL,
PRIMARY KEY (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2234 ;
INSERT INTO `user` (`userid`, `username`, `password`, `authtype`, `disabled`, `logonchange`, `expiry`, `ldapdn`, `cookieid`, `lastchanged`, `first_name`, `last_name`, `email`, `payroll_number`) VALUES
(1, 'administrator', '200ceb26807d6bf99fd6f4f0d1ca54d4', 'mysql', 0, 0, 0, '', 'e6f33989529daf141bd1406702b995fc', 1155190068, NULL, NULL, NULL, ''),
(2224, 'staff', '1253208465b1efa876f982d8a9e73eef', 'mysql', 0, 0, 0, 'NULL', '972b26e91f1a089cb0cafb16cbeb422c', 1156372109, NULL, NULL, NULL, ''),
(2233, 'guest', '', 'mysql', 0, 0, 0, NULL, NULL, 0, NULL, NULL, NULL, '');
I know it is late. :) See AUTO_INCREMENT=2234 in your code?
It says auto increment starts with 2234 which is correct for any further entries but when importing we are inserting with userid = 1 for the first entry which breaks the rule. This is the reason why you are getting error. You can remove the auto increment part from the create table statement and use the below statement after the Insert statements
ALTER TABLE user AUTO_INCREMENT = 2234;
Errors like: #1054-Unknown column 'xxxx' in 'field list' can be solved by simple editing the import file.

Joins in MySQL are not working

I am a beginner in MySQL and trying to create a join query in MySQL.
My first SQL query is as below which displays the 2 columns votes and post
SELECT votes, post
FROM `wp_votes` where votes!=''
GROUP BY votes,post asc LIMIT 0 , 30
**Second table is where the posts are **
SELECT *
FROM `wp_posts`
LIMIT 0 , 30
What i wanna do is create a join so that it display all records from wp_posts table WHERE wp_post.ID=wp_votes.post, Also have to check if wp_votes.votes!=''
I tried the following but i am stuck on it
SELECT * FROM wp_posts join wp_votes ON wp_posts.ID =wp_votes.post
Table Structure below
CREATE TABLE IF NOT EXISTS `wp_posts` (
`ID` bigint(20) unsigned NOT NULL auto_increment,
`post_author` bigint(20) unsigned NOT NULL default '0',
`post_date` datetime NOT NULL default '0000-00-00 00:00:00',
`post_date_gmt` datetime NOT NULL default '0000-00-00 00:00:00',
`post_content` longtext NOT NULL,
`post_title` text NOT NULL,
`post_excerpt` text NOT NULL,
`post_status` varchar(20) NOT NULL default 'publish',
`comment_status` varchar(20) NOT NULL default 'open',
`ping_status` varchar(20) NOT NULL default 'open',
`post_password` varchar(20) NOT NULL default '',
`post_name` varchar(200) NOT NULL default '',
`to_ping` text NOT NULL,
`pinged` text NOT NULL,
`post_modified` datetime NOT NULL default '0000-00-00 00:00:00',
`post_modified_gmt` datetime NOT NULL default '0000-00-00 00:00:00',
`post_content_filtered` longtext NOT NULL,
`post_parent` bigint(20) unsigned NOT NULL default '0',
`guid` varchar(255) NOT NULL default '',
`menu_order` int(11) NOT NULL default '0',
`post_type` varchar(20) NOT NULL default 'post',
`post_mime_type` varchar(100) NOT NULL default '',
`comment_count` bigint(20) NOT NULL default '0',
PRIMARY KEY (`ID`),
KEY `post_name` (`post_name`),
KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`),
KEY `post_parent` (`post_parent`),
KEY `post_author` (`post_author`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4570 ;
--
-- Table structure for table `wp_votes`
--
CREATE TABLE IF NOT EXISTS `wp_votes` (
`ID` int(11) NOT NULL auto_increment,
`post` int(11) NOT NULL,
`votes` text NOT NULL,
`guests` text NOT NULL,
`usersinks` text NOT NULL,
`guestsinks` text NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1052 ;
SELECT a.votes, a.post,
b.*
FROM wp_votes a
INNER JOIN wp_Post b
ON a.post = b.ID
WHERE a.votes <> ''
To further gain more knowledge about joins, kindly visit the link below:
Visual Representation of SQL Joins

insert trigger not working

I have the following table and trigger but the trigger isn't setting the create_dt value to now() on the insert event:
CREATE TABLE `user` (
`user_id` int(10) NOT NULL auto_increment,
`user_name` varchar(255) NOT NULL default '',
`password` varchar(255) NOT NULL default '',
`first_name` varchar(255) NOT NULL default '',
`last_name` varchar(255) NOT NULL default '',
`email` varchar(255) NOT NULL default '',
`modify_by` int(10) NOT NULL default '1',
`modify_dt` timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`create_by` int(10) NOT NULL default '1',
`create_dt` datetime NOT NULL default '0000-00-00 00:00:00',
`active` enum('Yes','No') NOT NULL default 'No',
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_name` (`user_name`),
UNIQUE KEY `email` (`email`),
FOREIGN KEY (`modify_by`) REFERENCES `user`(`user_id`),
FOREIGN KEY (`create_by`) REFERENCES `user`(`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
CREATE TRIGGER ins_user BEFORE INSERT ON `user` FOR EACH ROW SET #create_dt = NOW();
I've tried both BEFORE and AFTER trigger action time but no change. Does anyone have any suggestions?
The goal is to have the create_dt value set with a date_time NOW() value on insert.
Setting #create_dt sets a variable. You want to SET NEW.create_dt = NOW(). This will change the value of the incoming record.