mysql

Is there a MySQL command to implement something like "drop tables except t1,b2"?

I want to keep t1,t2 and drop all other tables. ...

Has anyone tried dumping MySQL data on windows directly to MySQL on linux?

windows: mysqldump .... > windata.sql; linux: mysql ... < windata.sql Will the data be cross-platform? ...

Querying in the return of another query using C# within a single MySQL connection

I have a c# app that I am working on and wish to run a query and then run another query within the output of the ExecuteReader. My question is that can this be done within a single connection or do I have to close and re-open the connection everytime I want to run a new query? ...

How to select data from a table where the table name has blank spaces in?

I have a situation, I have a mySql table named 'Master File' with contains 6000 records. Howver I get an error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource My code looks as below. $sql = "SELECT * FROM Master File"; $results = mysql_query($sql); //Looping threw the Master File while($row = my...

MySQL: grab one row from each category, but remove duplicate rows posted in multiple categories

Hi all. I have a database of articles, which are stored in categories. For my homepage, I want to grab an article from each category (I don't care which). However, some articles are crossposted to multiple categories, so they come up twice. I have a table called tblReview with the article fields (reviewID, headline, reviewText) and a ...

Replication from MySQL to MS SQL

Hello, I'm facing a new challenge here. I can't seem to find precedence for replication from MySQL, running on a Linux box to MS SQL Server. Has anybody done this before? Most importantly all changes made to the MySQL database should be replicated on the MS database realtime or close. MS database are not likely to be updated in any ot...

How to access MySQL from multiple threads concurrently

We're doing a small benchmark of MySQL where we want to see how it performs for our data. Part of that test is to see how it works when multiple concurrent threads hammers the server with various queries. The MySQL documentation (5.0) isn't really clear about multi threaded clients. I should point out that I do link against the thread ...

Warning: mysql_connect(): Access denied for user '‎‎u1' ?

This is extremely basic and I apologize for asking such a rookie question. But I a getting this error: Warning: mysql_connect(): Access denied for user '‎‎u1'@'172.16.3.139' (using password: YES) in /usr/local/pem/vhosts/103503/webspace/httpdocs/eirestudio-tools/crm/add-contact.php on line 53 The user says ‎‎u1? What does ...

MySQL Connector C++ - make Error 1

Hi! I'm writing an application in C++ (using Eclipse with Linux GCC) that's supposed to interact with my MySQL server. I've downloaded the MySQL Connector C++ a, precompiled, and copied the files into the directories (/usr/lib, /usr/include). I've referenced in in the GCC C++ Linker Section of the Project Properties in Eclipse ( "mysqlc...

What will you do to optimize MySQL performance in this case?

$query = "select * from a ..."; if($result = mysql_query($query,$con)) {while($row = mysql_fetch_array($result);) $arr[0][] = $row; } $query = "select * from b ..."; if($result = mysql_query($query,$con)) { while($row = mysql_fetch_array($result);) $arr[1][] = $row; } $query = "select * from c ..."; if($result = mysql_query($query,$...

how to remove html tags and php serialization info from mysql result without php?

I'm storing a PHP array where key=>value pairs are information used to build jQuery UI tabs on a website. The string stored in the MySQL database looks like: a:2:{i:0;a:2:{i:1;s:9:"Info";i:2;s:643:"<h2><strong>This section is about foo</strong></h2><p><strong>Lorem ipsum ...";}i:1;a:2:{i:1;s:14:"More Info";i:2;s:465:"<p>Lorem ipsum ......

PHP, SQL newbie help

I have the following table: Comments -------- id PK cid content uid comment If the content is image /i want it to print ?imgID=$cid and get the data from the row title from the table images and if it's a thread I want it to print ?threadID=$cid and get the title from the table threads and so on. How should I do this? <h3...

Help with Java Applet

I'm new to Java and I need some advice/information on how to debug my Java Applet. I have created a applet that simply updates a mysql database. The applet seems to load in the webpage with no errors. When I click on my button to update the database it seems to actually make the call to the applet, BUT nothing happens, i.e. no new ins...

How to Pass a list as a param in .NET

Hello, I have a query that is basically like this: SELECT foo FROM bar where bar.Id in (1,2,3); I would like to pass the list of Id's in as a single param with IDbDataParameter where the query is formatted: SELECT foo FROM bar where bar.Id in (?ListOfID); and then have a single param that is a list rather than having to do some...

JOIN on where data, or put it in the where clause?

I'm trying to join a subset of data from one table with data in another table (example below), and from a performance standpoint, i'm wondering what the best way to do this is, and what is most scalable. The table I am trying to join looks like this (the other tables are already in the query). vid kid uid 1 ...

Can someone show me how to populate the following MySQL table?

Can someone please show me how to pouplate the following table with my own tags, ids and count numbers using the phpMyAdmin or a MySQL command prompt? CREATE TABLE tags ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), tag varchar(100) NOT NULL, count int(11) NOT NULL DEFAULT '0' ); ...

Constructing a multi-argument MySQL Search Query

Hi, I'm attempting to construct a search query in MySQL using multiple arguments, and I can't quite get it right. I'm receiving the search arguments from a form, and using them to dynamically build my query. Here is some background info: I have a MySQL database containing job information. There are four columns I want to search: J...

What is the fastest way to load an XML file into MySQL using C#?

Question What is the fastest way to dump a large (> 1GB) XML file into a MySQL database? Data The data in question is the StackOverflow Creative Commons Data Dump. Purpose This will be used in an offline StackOverflow viewer I am building, since I am looking to do some studying/coding in places where I will not have access to the in...

How to select an empty result set?

I'm using a stored procedure in MySQL, with a CASE statement. In the ELSE clause of the CASE ( equivalent to default: ) I want to select and return an empty result set, thus avoiding to throw an SQL error by not handling the ELSE case, and instead return an empty result set as if a regular query would have returned no rows. So far I've...

What is the most efficient way to do check if a value exist then Update or Insert in Sql

Hi I need to update date a value in table if it does not exist then it must be inserted What is the best way to does this in MySql Currently I am using SELECT Id INTO LId FROM ATABLE WHERE ID = FID; IF LId IS NULL THEN INSERT INTO ATABLE(abc) Values (2) ELSE UPDATE ATABLE Set Abc = 2 Where Id = LId END IF; ...