SQL - Connection Deletion - mysql

I'm trying to delete all connections to a database, because I made a mistake and forgot to place mysqli_connect($con) in a number of pages.
On StackOverflow I found the following question: How do you kill all current connections to a SQL Server 2005 database?
However, when I use the following query, I get an error in phpMyAdmin:
ALTER DATABASE `dotnettv_db` SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
Error:
#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 '[`dotnettv_db`] SET SINGLE_USER WITH ROLLBACK IMMEDIATE' at line 1
I would appreciate it if you could tell me what I am doing wrong. Thanks!
EDIT: This is what I am getting in phpMyAdmin: http://oi43.tinypic.com/2v0k8rc.jpg - one process, around 50 connections. The biggest problem is with the traffic associated with these connections - 3.3 Terabytes and counting in 6 days: http://oi41.tinypic.com/2lj6n9t.jpg

You are not using SQL-Server (from Microsoft) but MySql so the SQL-Command won't work.
Check this for help: how to kill mySQL connections

Related

Update query suddenly stopped working after migration on Unix server

a program that worked until a few days ago today gave back the following error in Production environment :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntaz to use near', owner='user#domain', check_datetime=NOW(), WHERE id = 26922 at line 1.
the complete query is :
**UPDATE anomalie_ordini.taa_tb_overview_rapporti
SET status_rapporto_id= <val_num>, owner='<val_char>', check_datetime=NOW()
WHERE id=<val_num>**
the same query run in Development environment without problems.
Could be tied to a migration of the server where the query runs?
Hope you can help me.
Thank you.
EDIT: find the error, one of the columns were named ROWS, a reserved word (not my choice :) )

Sql Syntax error with Doctrine, probably because of change of Mysql version

I've programmed a project in symfony and mysql 5.6. then I uploaded my project to a remote server on 1&1. the remote server has mysql 5.7 version. All doctrine queries run ok and without problem. But when a user searches something, a request will be sent to the server and a doctrine query will be executed. Here it returns the following error:
SQLSTATE[42000]: Syntax error or access violation: 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 'integer)
BETWEEN 1940 AND 2002) AND u0_.id <> 2' at line 1
I think, it is probably because of different versions of mysql. Because on localhost it runs without problem
Can you please help me how to solve it? is there a way to regenerate all the migrations according the new mysql version? or may be there is another solution?
thanks
I was using CAST('number' as integer) in mysql 5.6. It did ok. However in mysql 5.7 and I do not know why, it does not run ok. So I changed it to CAST('number' as UNSIGNED) and it works ok

PHPMyAdmin has retained a bad query I typed as the default "browse" query

Yesterday I typed a bad query into the SQL box of PHPMyAdmin.
Ever since, when I click on my database table in the bar on the left, or click the Browse button, my query is used as the default query. Or rather the part I typed at the end is added to every query.
I get an error dialog reading
#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 'offset1000
LIMIT 0, 30' at line 1
which is my bad query. How can I get rid of this? Is there a cache with this query in it somewhere?
Details: PHPMyAdmin 4.0.10deb1ubuntu0.1 / Apache/2.4.7 (Ubuntu) / Ubuntu 14.04.1 and yes, I've logged out and even rebooted the server.
I have found the answer to this after a lot of searching.
PHPMyAdmin 4 has a table for this helpful feature.
It's in the database phpmyadmin, table pma_table_uiprefs. Stored against my username, that table and database was the bad query. I deleted it, which didn't help right away, but when I logged out and back in, it was gone.

Mysql syntax errors on import

I need some help with mysql errors keep popping up. Some time ago I could easily export (mainly WordPress) databases from my localhost and import these (via phpmyadmin import) on the webserver to push my websites live. Since a few days I keep getting different mysql error while importing these databases..
I tried a couple of things, changing charactersets, collate settings, ... Nothing seems to work.
I'm not a DB guy, so maybe this is something easy, but I can't seem to figure it out on my own..
Local (xampp on mac)
Databaseserver
--------------
Server: Localhost via UNIX socket
Servertype: MySQL
Serverversie: 5.6.26 - Source distribution
Protocolversie: 10
Gebruiker: root#localhost
Karakterset van server: UTF-8 Unicode (utf8)
Webserver
Databaseserver
--------------
Server: Localhost via UNIX socket
Servertype: MySQL
Serverversie: 5.5.31 - MySQL Community Server (GPL)
Protocolversie: 10
Gebruiker: t2c_projects#localhost
Karakterset van server: UTF-8 Unicode (utf8)
Can someone please help me out? I can give all the info needed, don't know which are relevant.. So anyone need additional info please let me know.
Any help is welcome!
Update1:
Errors I'm getting
#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 ''<div class="rss-widget"><ul><li><a class=\'rsswidget\' href=\'https://wordpress' at line 9
This error is from a database in development, I tried a fresh installation db import and then I'm getting this:
#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 'CREATE TABLE `wp_termmeta` ( `meta_id` bigint(20) UNSIGNED NOT NULL, `term_i' at line 11
I keep getting different syntax errors, I allready tried manually fixing these but they just keep me changing stuff so I'm trying to fix this core issue..
I have a suspicion it has something to do with mysql versions or character sets..
Update2:
So I tried fixing the first (mixed html) error, and after I removed all \' by ", I get new errors (83 errors):
#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 '2016-03-29 10:21:45', '0000-00-00 00:00:00', ' ', '', '', 'draft', 'closed', 'cl' at line 5
It simply seems that your SQL statements are mixed with HTML at some point
#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 ''<div class="rss-widget"><ul><li><a class=\'rsswidget\' href=\'https://wordpress' at line 9
If you believe that it is not the case (e.g. you insert html in rows), please add the full queries to your post, but the issue seems pretty obvious :)
Maybe that some copy/paste manipulation error led to that state.
Without checking the full statement that causes the error, can't say more at the moment..

MySql : wait_timeout & "mysql server has gone away" error message

I've a page which selects data from a table based on the primary key of the table
ex: SELECT * FROM table_name WHERE id=primary_key_value
As soon as I execute this from my CI page, I'm getting following error message
"Mysql server has gone away"
I searched in mysql reference manual, they are telling, its the cause of "wait_timeout" in configuration file. My configuration file has following settings
wait_timeout = 10
Could someone help me resolve this issue?
MySQL Server Has Gone Away - MySQL 5.5
link
Another one