mysql

Moving mySQL db from linux svr to windows svr - different versions of mySQL

In an attempt to consolidate some servers here, I need to move my primary Intranet application DB from a RHEL5 server to a Windows 2003 server. The Intranet DB is nothing amazing yet - little over 5mb and roughly 49 tables. On RHEL5, I'm on mySQL 5.0.45 On Windows 2003, I'm on mySQL 5.0.51a So, I tried mysqldump to a sql file and imp...

How can we do mysqldump to another DB using php script such that triggers do not get dumped along with that?

How can we do mysqldump to another DB using php script such that triggers do not get dumped along with that? ...

select field information with min time value

Hey guys quick question, I thought I was doing the right thing but I keep getting the wrong result. I am trying to simply find the id of the entry with the min time, but I am not getting that entry. $qryuserscount1="SELECT id,min(entry_time) FROM scrusersonline WHERE topic_id='$topic_id'"; $userscount1=mysql_query($qryuserscount1); whil...

Connecting a django application to a drupal database?

I have a 3 - 4000 nodes in a drupal 6 installation on mysql and want to access these data through my django application. I have used manage.py inspectdb to get a skeleton of a model structure. I guess that there are good/historical reasons for drupal's database schemes, but find that there are some hard to understand structure and that t...

Text-correlation in MySQL

Hi guys, I have three coloumns in my table, all containing text. I want to calculate a correlation between coloumn A and B, and A and C. How can I do this, and can I do it within MySQL? For example, I can have the values ('Hello world', 'ello world', 'Good bye'), ('Hello world', 'H e l l o', 'Bye world') Cheers Nik ...

How to select data with a certain minimum total?

I have one table bbc(country, region, area, population, gdp). I want to select the regions with a total population of at least 100 million. How can I do it with SQL? ...

MySQL Workbench 5.2. Load INSERTs from a file

How can I load INSERTs from a file in MySQL Workbench 5.2? I have tutorial for 5.0, but for 5.2 it is not working ...

How to update a table using a select group by in a second one and itself as the data source in MySQL?

I can do this: SELECT t2.value + sum(t3.value) FROM tableA t2, tableB t3 WHERE t2.somekey = t3.somekey GROUP BY t3.somekey But how to do this? UPDATE tableA t1 SET speed = ( SELECT t2.value + sum(t3.value) FROM tableA t2, tableB t3 WHERE t2.somekey = t3.somekey AND t1.somekey = t3.somekey ...

Ruby on Rails: Updating table record on a timed basis

I'm trying to create something similar to the stackoverflow "user score" on my site with a mysql. I don't want to be calculating this score every time a user is accessed because multiple user scores will be displayed at the same time and the way it's calculated doesn't require it to be updated frequently. My thoughts are to update all ...

mysql select records greater than 3 months

I am trying to write a query to select all records from users table where User_DateCreated (datetime field) is >= 3 months from today. Any ideas? Thanks! ...

mysql: whoami ?

Is there a whoami-like function in mysql? I'm connecting to the mysql command line from a remote host. I'm not sure if my ip address is resolving to a domain name or not. I would like to see something like mysql> whoami; +----------------------------------+ | User | Host | +----------------------------------+ | u...

Fixing "Lock wait timeout exceeded; try restarting transaction" for a 'stuck" Mysql table?

From a script I sent a query like this thousands of times to my local database: update some_table set some_column = some_value I forgot to add the where part, so the same column was set to the same a value for all the rows in the table and this was done thousands of times and the column was indexed, so the corresponding index was prob...

unix timestamps and php

I have a list of unix timestamps in a database, and I wanting to select the ones that are from today. i.e If today is Tueday, I want to get all the timestamps that were made today? Is it possible? Is there such a things as strtotime("Today")? Any help would be great ...

MEMORY(HEAP) vs. InnoDB in a Read and Write Environment

I want to program a real-time application using MySQL. It needs a small table (less than 10000 rows) that will be under heavy read (scan) and write (update and some insert/delete) load. I am really speaking of 10000 updates or selects per second. These statements will be executed on only a few (less than 10) open mysql connections. The...

Password verification; Is this way of doing it safe?

I have a classifieds website, where everybody may put ads of their products. For each classified, the user has to enter a password (so that they can delete the classified whenever they wish). So basically, when somebody wants to delete a classified, they click on the classified, click on the delete button, and enter the pass. I use My...

MySQL SELECT, store in a variable

For a stored procedure, I want to do a SELECT, and store a column's value into a variable. How do I do this? I want to do something like this: DECLARE countTemp INT; SET countTemp=(SELECT COUNT(Name) FROM mytable WHERE Name= var_name LIMIT 0,1); OR, like this : DECLARE countTemp INT; SELECT countTemp=ColumnXYZ FROM ...

Is the MySQL FOSS License Exception transitive - does it remove the GPL restrictions for downstream clients?

I'm looking at building a MySQL client plugin for a proprietary product, which would violate the GPL as discussed in the FAQ at http://www.gnu.org/licenses/gpl-faq.html#NFUseGPLPlugins However, according to the MySQL FOSS License Exception ("FLE"), discussed at http://www.mysql.com/about/legal/licensing/foss-exception/, you can license ...

MySQL SELECT Statment to return 2 coloumns into 1

Hi, I have a table with the following columns id, teamA_id, teamB_id Will it be possible to do a MYSQL SELECT statement that gives both teamA_id and teamB_id in the same column? EDIT Consider this example From id, teamA_id, teamB_id 1, 21, 45 2, 34, 67 I need Teams 21 45 34 67 ...

mysqldump backup and restore to remote server

how can i use mysqldump to backup and restore database to a remote server both have root access i am using putty i tried this mysqldump -u root -p >z*x311a!@ masdagn_joom15 | mysql \ -u root -p g2154hE6-AsXP --host=207.210.71.26 -C masdagn_joom15temp \g but it refused localpassword: >z*x311a!@ remote password: g2154hE6-AsXP ...

Will these security functions be enough? (PHP)

I am trying to secure my site so I don't have sql injections and xss scripting. Here's my code. //here's the from, for brevity, i just show a field for users to put firstname <form> <label for="first_name" class="styled">First Name:</label> <input type="text" id="first_name" name="first_name" value="<?php if (!empty($first_name)) echo ...