Getting extra column 'require_validation' when asking for table columns - php

When using the query
select distinct(column_name) as column_name, data_type from information_schema.columns
where table_name='reg_add_ons' order by ordinal_position
I get an extra column on my dev server. On my local server everything works fine. This is the only table this happens on. I have tried dropping the table and adding it again with this statement
delimiter $$
CREATE TABLE `reg_add_ons` (
`add_on_id` int(10) NOT NULL AUTO_INCREMENT,
`eventcode` varchar(20) DEFAULT NULL,
`add_on_desc` varchar(250) DEFAULT NULL,
`add_on_price` decimal(10,2) DEFAULT NULL,
`add_on_detail` text,
`add_on_label` varchar(100) DEFAULT NULL,
`add_on_choices` varchar(200) DEFAULT NULL,
`image_name` varchar(100) DEFAULT NULL,
`internal_only` varchar(2) DEFAULT NULL,
`assign_code` text,
`reg_status` varchar(50) DEFAULT 'Active',
PRIMARY KEY (`add_on_id`)
) ENGINE=MyISAM AUTO_INCREMENT=89 DEFAULT CHARSET=latin1$$
I have a bit of the flu so this is not making sense to me right now.
Dev box is a Windows 7 machine running MySQL 5.6.10
Localhost is Windows 7 running MySQL 5.5.24
Production server is Linux MySQL 5.0.45
It is only this one table on this one machine (Dev) having problems. what is the field require_validation? Where does it come from?
Any insight is appreciated

Related

PDO query updating a datetime column not in query Part 2

Continuation from this question:
PDO query updating a datetime column not in query
A column in my table called lastLoginDate was being automatically updated even though my prepared statement did not include said column.
Apparently, when I created the new column, a trigger was set.
Upon using the command SHOW CREATE TABLE table_name, I returned the following results:
CREATE TABLE `users_edi` (
`username` varchar(30) NOT NULL DEFAULT '',
`fullname` varchar(50) DEFAULT NULL,
`userlevel` tinyint(1) unsigned NOT NULL,
`ipaddress` varchar(30) DEFAULT NULL,
`email` varchar(150) DEFAULT NULL,
`entrydate` datetime DEFAULT NULL,
`division` varchar(35) DEFAULT NULL,
`password` varchar(32) DEFAULT NULL,
`userid` varchar(32) DEFAULT NULL,
`timestamp` int(11) unsigned NOT NULL,
`job_title` varchar(30) DEFAULT NULL,
`dept` varchar(50) DEFAULT NULL,
`phone` varchar(11) DEFAULT NULL,
`lastLoginDate` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, // <-- here
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
The table is years old. I just created the column and somehow, a trigger was set to it (I guess).
Regardless, I tried to remove it using the following command:
ALTER TABLE `users_edi`
`lastLoginDate` datetime DEFAULT NULL
But I only get the following error:
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`lastLoginDate` datetime DEFAULT NULL' at line 4
How do I remove this trigger using the ALTER TABLE command or any other command?
ALTER TABLE users_edi MODIFY COLUMN lastLoginDate DATETIME DEFAULT NULL;
You might like to read this page on ALTER TABLE: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html

MySQL DB Migration fail

For a wordpress website I am trying to migrate the website and MySQL database. Although when I import it, it gives me an error. I no longer have access to the old one.
Error
SQL query:
CREATE TABLE `wp_commentmeta` (
`meta_id` bigint(20) UNSIGNED NOT NULL,
`comment_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`meta_key` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`meta_value` longtext COLLATE utf8mb4_unicode_520_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci
MySQL said: Documentation
#1046 - No database selected
1046 - No database selected Should have been a bit of a clue. Add a USE DATABASE_NAME; at the top of this script. So that MYSQL knows which database you are trying to create the table in
– RiggsFolly

WordPress Install Error [Unknown character set: 'utf']

I am trying to install the latest version of WordPress(4.6.1) in a local dev project environment. I just got a new iMac and I am in the process of moving my local instances of my projects to the new machine.
I am using Sequel Pro (v 1.1.2) to manage my databases & MAMP (3.4) to run my local server.
The connection to the database works as intended and I get to step 2 of the installation process however after putting in the following and clicking install there are errors and no tables are created in my database.
Site Title,
Username,
Password,
email,
Any help would be greatly appreciated. I am sure its something dumb. Just need another set of eyes. Thanks!
WordPress database install error:
WordPress database error: [Unknown character set: 'utf']
CREATE TABLE wp_users (
ID bigint(20) unsigned NOT NULL auto_increment,
user_login varchar(60) NOT NULL default '',
user_pass varchar(255) NOT NULL default '',
user_nicename varchar(50) NOT NULL default '',
user_email varchar(100) NOT NULL default '',
user_url varchar(100) NOT NULL default '',
user_registered datetime NOT NULL default '0000-00-00 00:00:00',
user_activation_key varchar(255) NOT NULL default '',
user_status int(11) NOT NULL default '0',
display_name varchar(250) NOT NULL default '',
PRIMARY KEY (ID), KEY user_login_key (user_login),
KEY user_nicename (user_nicename),
KEY user_email (user_email) )
DEFAULT CHARACTER SET utf-8
WordPress database error: [Unknown character set: 'utf']
CREATE TABLE wp_usermeta (
umeta_id bigint(20) unsigned NOT NULL auto_increment,
user_id bigint(20) unsigned NOT NULL default '0',
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (umeta_id),
KEY user_id (user_id),
KEY meta_key (meta_key(191)) )
DEFAULT CHARACTER SET utf-8
WordPress database error: [Unknown character set: 'utf']
CREATE TABLE wp_termmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,
term_id bigint(20) unsigned NOT NULL default '0',
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (meta_id),
KEY term_id (term_id),
KEY meta_key (meta_key(191)) )
DEFAULT CHARACTER SET utf-8
wp-config.php file
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf-8');
The database itself is set at:
Database Encoding: UTF-8 Unicode (utf8)
Database Collation: utf8_general_ci
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
WordPress Codex
If you want to use the DDL format you've got than this will work.
DEFAULT CHARACTER SET utf8

SQL query on server returns SQL Error while on localhost works fine

I have the following SQL query
CREATE TABLE IF NOT EXISTS `Log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`customer_id` int(11) unsigned NOT NULL,
`request_xml` BLOB NOT NULL,
`response_xml` LONGBLOB NOT NULL,
`timestamp_process_end` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`timestamp_response` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
);
could someone see any mistakes? Because it gives me a SQL Error when I run the code on server. But on localhost works without any problems (or phpmyadmin)
And btw this works on the server:
CREATE TABLE IF NOT EXISTS `lang` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`language` varchar(2) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
PRIMARY KEY (`id`)
);
that is written in the same style. Any remarks?
LE: Mysql Ver 14.14 Distrib 5.1.73
In the end, the problem was that on the remote server I couldn't have two DEFAULT CURRENT_TIMESTAMP, as stated here mysql link, but this is wired that on the localhost worked.

The used table type doesn't support FULLTEXT indexes

I'm trying to do a fulltext search but it's not working in my web app. Here's an echo of the query and the error message:
SELECT name,id,city,state FROM campgrounds
WHERE MATCH(name, city, state) AGAINST('camp' IN BOOLEAN MODE)
Invalid query: The used table type doesn't support FULLTEXT indexes
I have converted the table to MyISAM and then dropped the index and recreated it.
delimiter $$
CREATE TABLE `campgrounds` (
`id` int(11) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`address` varchar(145) DEFAULT NULL,
`city` varchar(145) NOT NULL,
`state` varchar(5) NOT NULL,
`zip` int(11) NOT NULL,
PRIMARY KEY (`id`),
FULLTEXT KEY `name` (`name`,`city`,`state`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8$$
If I copy the above query into MySQL Workbench and run it, it works.
I'm a bonehead! MySQL workbench was attached to another server. I set it to my test server and the converted that table to MyISAM and all is good
Clear the cache of your App (Memcache or query cache). Because if it works with mysqlworkbech then it should also work with web app.

Categories