I have a blocking problem with my mysql dabatase.
I have a php website with a MySql database.
Everything works fine.
I just put a sql dump from one old database server to a new database server and since, on this new server I have a weird behaviour:
A query like:
select * from toto where date(myDateField) between '2001-01-01' and '2012-01-01';
Does not work. What I mean is that it does not return any results (no errors either).
If I do the following :
select * from toto where myDateField between '2001-01-01' and '2012-01-01';
It works.
I tryied to see if on my new server my mysql system variables are different but all seems the same.
The weird thing is that on this new server I allready put another dump last week and everything worked juste fine.
Now I have no idea.
I cannot go and modify all my php files, since the website works fine on others servers. I just want to find the problem and the explanation.
Anyone has any hint on this?
UPDATED:
I have done more tests.
I have 2 databases on the same server.
On the first one (created a older dump) everything it's fine.
On the second one (created using a recent dump file) I have the problem.
So I don't really know what could be the problem.
First check the which format do u get in your server
select date(myDateField) from toto
Based on the format use between condition ... the date format may change form server to server i.e dd//mm//yyyy or yy//mm/dd check that ....
I finally managed to make it work. I installed the same dump on a different linux distribution and now it works. Before I had Gentoo and now I have Ubuntu.
So it must be something wrong on Gentoo.
Related
I i want to take the results like bassed on today date.how many registration heppaned in today, i written the query in mysql it is woring fine in local server when ever going to live server not working properly
I have like this (task is tableNname)
id taskName t_completed_on
1 Search Module 2017-03-14 06:50 AM
bassed on my table results(COUNT) will return 1,this my tried code.
SELECT COUNT(*) FROM `task` WHERE DATE(`t_completed_on`) = CURDATE() AND t_project!='Miscellaneous'
Same code working for my local xampp server,but not working in live server what is the issue please tell me anyone and update the answer.
Your local and live servers could be using different timezones
I have a problem and not sure if this is possible. My web application has a database and i'm using a mysql workbench and using wamp server.
My web app has a database name healthcare, and if I import again another database with the same tables, etc but addition data. I want the first database to be updated only with new values but not replaced.
Is it possible?
Edit: I searched in the net and other related sources and I manage to set my phpmyadmin "Ignore multiple statement errors". When I import the second database (.sql with same tables but with new data) it does not update the first database but the message is successful. Please help, I'll appreciate any help...
in the past ive searched for tools to do some similar database sync tasks - in my experience ive found that none are free & reliable.
have you tried writing some queries to do this manually?
first thing that comes to mind would be figuring out a key you can use to evaluate each row and determine if you should copy said record from database A to database B.
afterwards you could simply do an INSERT(SELECT)
INSERT INTO healthcare_DESTINATION.table (SELECT * FROM healthcare_SOURCE WHERE some_condition = 1);
obviously this is the simplified version - but i've done something very similar utilizing timestamps (eg only copy rows newer than the newest row in the destination table)
hope this helps
It is very strange what is happening, I have never seen this before and I am pretty familiar with mysql.
When searching a table using the phpMyAdmin table search feature, the result is empty no matter what I put. For example, searching 77 in the ID column returns empty result. However if I run an SQL query also in phpMyAdmin, and then there is the result. For example, select * from table1 where id = ‘77’;
What is even more strange is this only happens on one table, all other tables the search feature is working fine.
I tried repairing the table but empty result still occurs.
I couldn’t find this happening anywhere to any one online…..
Also restarted sql server.
Are you using cPanel - if yes I just described how to fix the problem on cPanel forums:
http://forums.cpanel.net/f5/unable-use-phpmyadmin-search-users-table-313381.html
If your table has a large number of fields an update via the phpMyAdmin interface can exceed the value for the PHP setting 'max_input_vars'. When this happens some of the internal form fields that phpMyAdmin is expecting to receive on the page your update is being posted to are truncated which causes phpMyAdmin to fail, unfortunately silently, and the page redirects with no warnings back to the blank search form. The default for 'max_input_vars' is 1000. I upped mine in my php.ini file to 5000 with no negative side affects and it solved this problem for me.
The setting 'max_input_vars' has a mode of PHP_INI_PERDIR so if you don't have access to your php.ini file then you may be able to set it in an .htaccess file, your httpd.conf file or your .user.ini (since PHP 5.3) file if you have one. I'm not sure exactly what code you would need for an htaccess file but the PHP code to do it is below.
ini_set('max_input_vars', '5000');
Hopefully that should get you started in the right direction.
Very easy. Go to the table and expose max number of rows as much as is showed in the dropdown. Then you are able to search per big pages. It doesnt fetch text through all the table. It plays only with a page of the table.
I'm currently moving a large PHP-based webapp from one server to another. The old server is running MySQL 5.0.51a (on SuSE Linux), the new server is running MySQL 5.5.15 (on ArchLinux).
Now, the new MySQL is complaining about the following statement (Syntax Error):
SELECT DISTINCT(field) FROM config WHERE range='global' ORDER BY field
I did a bit of testing and found out that the following shortened statement still fails (with Syntax Error):
SELECT * FROM config WHERE range='global'
Unfortunately, this looks like perfectly legal SQL to me. My guess is that it has to do with the type of column range, which is enum('global', 'user'). Selecting from other columns, e.g. columns of type int, works perfectly fine.
I know how to fix this issue locally, i.e. adding the column name to the where-clause, like this:
SELECT * FROM config WHERE config.range='global'
But I don't want to go through the whole code, adding column names to SQL statements where appropriate.
Hence my question:
How do I tell MySQL 5.5.15 to accept the somewhat sloppy 5.0.51a syntax?
RANGE is a reserved word in mysql 5.5 see list
Protect your field, it sould work:
SELECT * FROM `config` WHERE `range`='global'
I use Kettle for some transformations and ran into a problem:
For one specific row, my DatabaseLookup step hangs. It just doesn't give a result. Trying to stop the transformation results in a never ending "Halting" for the lookup step.
The value given is nothing complicated at all, neither it is different from all other rows/values. It just won't continue.
Doing the same query in the database directly or in a different database tool (e.g. SQuirreL), it works.
I use Kettle/Spoon 4.1, the database is MySQL 5.5.10. It happens with Connector/J 5.1.14 and the one bundled with spoon.
The step initializes flawlessly (it even works for other rows) and I have no idea why it fails. No error message in the Spoon logs, nothing on the console/shell.
weird. Whats the table type? is it myisam? Does your transform also perform updates to the same table? maybe you are locking the table inadvertantly at the same time somehow?
Or maybe it's a mysql 5.5 thing.. But ive used this step extensively with mysql 5.0 and pdi 4.everything and it's always been fine... maybe post the transform?
I just found the culprit:
The lookup takes as a result the id field and gave it a new name, PERSON_ID. This FAILS in some cases! The resulting lookup/prepared statement was something like
select id as PERSON_ID FROM table WHERE ...
SOLUTION:
Don't use underscore in the "New name" for the field! With a new name of PERSONID everything works flawlessly for ALL rows!
Stupid error ...