Hello,
I wasn't able to find out (googling, reading mysql reference manual) how to get value of DATETIME in seconds in MySQL.
I dont mean to extract seconds from datetime, but to convert it into seconds.
Thanx
We use MySQL server 5.1.43 64-bit edition. InnoDB is used as engine.
We have a sql script which we execute every time we build the application.
On ubuntu machine with MySQL server and InnoDB engine it takes about 55 seconds to complete the execution.
If I run the same script on OSX, it takes close to 3 minutes!
Any ideas why OSX is so slow while executing this script?
Hi All,
I am using Kohana 3. I want to log the MySQL queries being executed by an application. The reason to determine the query of type INSERT,UPDATE and DELETE which are being executed in a process and store them in another MySQL table with date-time for further reference.
Can anybody tell how can I achieve this?
Hi,
what are your mysql ninja tricks? What features are extra special?
I'm starting with ORDER BY FIELD which enables you to sort in a particular order, like this:
SELECT url FROM customer ORDER BY FIELD(customer.priority, 1, 2, 3, 0)
Features like this is hard to find in the mysql documentation.
Bring it!
I tried to build an index over a two columns of a 30,000,000 entry database.
I canceled the process after ~60hr as it didn't seem to work.
For some reason MySQL takes only 22 mb ram instead of using the RAM fully.
Is index building an operation that needs no Ram or is there some way to tell MySQL to use more RAM to be faster?
I am trying to access some information from mysql, but am getting the warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource for the second line of code below, any help would be much appreciated.
$musicfiles=getmusicfiles($records['m_id']);
$mus=mysql_fetch_assoc($musicfiles);
for($j=0;$j<2;$j++)
{
if(file_exists($mus['musicpath']))
{
echo '<a href="'.$mus['musicpath'].'">'.$mus['musicname'].'</a>';
}
else
{
echo 'Hello world';
}
}
function getmusicfiles($m_id)
{
$music="select * from music WHERE itemid=".$s_id;
$result=getQuery($music,$l);
return $result;
}
Hi guys,
I have this code in PHP. It connects to the DB fine, but pops an error, when tryinto to insert the info.
$dbc = mysqli_connect('localhost', 'root', 'marina', 'aliendatabase') or die('Error connecting to MySQL server.');
$query = "INSERT INTO aliens_abduction (name, email) VALUSE ('John', '[email protected]')";
$result = mysqli_query($dbc, $query) or die('Error querying database.');
mysqli_close($dbc);
Here's a screenshot: http://img532.imageshack.us/img532/2930/63306356.jpg
Thanks,
R
Hi,
I'm trying to upgrade our company's 4.1.22 version of MySQL to 5.
I'm using
sudo yum --enablerepo=centosplus upgrade mysql*
but keep getting an error of conflicted files with the 4.1 version.
Does that mean there really isn't any other way than uninstalling 4.1 and installing 5.0? I have read that using the yum upgrade command should work however...
Thanks in advance!
I have a Windows Application in C#. This application interacts with a remote mySQL database. Should I create a PHP web service to do these (insert/add/delete/update) or use mySQL connector for c#? I'm not sure which way is better.
Thanks!
I have MySQL data that looks like this:
+----------------------------------------+
|Name | kode | jum |
+----------------------------------------+
| aman |kode1 | 2 |
| aman |kode2 | 1 |
| jhon |kode1 | 4 |
| amir |kode2 | 4 |
+--------------------+-----------+-------+
How can I make the table look like this one, using a MySQL query?
kode1 kode2 count
aman 2 1 3
jhon 0 4 4
amir 0 4 4
Hi All,
I'm trying to determine which my.cnf mysql is using. Is there a command or something for mysql or mysqladmin that shows which one is being loaded?
I was given the daunting task of converting a ASP website to PHP and MSSQL to MySQL, and I ran into an issue that hopefully somebody can help
I have a user table which has a password field with datatype Varbinary(128), are using pwdencrypt to encrypt the password.
Is there a way to transfer that over to MySQL, and somehow i need to be able to keep the password intact... how can i go about that? any pointers would be greatly appreciated!
Hello,
do you have any tips for some GUI applications (free) that are capable of debugging MySQL stored procedures?
I tried devArt dbForge MySQL Studio which worked just fine, but it's not free.
Thanks for any tips.
Hi! What would be an appropriate way to do this, since mySQL obviously doesnt enjoy this.
To leave either partitioning or the foreign keys out from the database design would not seem like a good idea to me. I'll guess that there is a workaround for this?
Update 03/24:
http://opendba.blogspot.com/2008/10/mysql-partitioned-tables-with-trigger.html
http://stackoverflow.com/questions/1537219/how-to-handle-foreign-key-while-partitioning
Thanks!
I want to know if I can repopulate the autoincrement value in mysql.
Because, I have records that look similar:
ID Name
1 POP
3 OLO
12 lku
Basically , I want a way to update the ID to this
ID Name
1 POP
2 OLO
3 lku
Is there any way to do this in mysql?
Thanks.
How can I serach word with "&" using mysql full text search ?
There are words string, like "Marks & Spencer", "at&t" in my tables , serach "at&t", but can't find it on the database using mysql full text search
Any ways to serach word with "&"?
Question: How can I process a form using jQuery and the $.ajax request so that the data is passed to a script which writes it to a database?
Problem:
I have a simple email signup form that when processed, adds the email along with the current date to a table in a MySQL database. Processing the form without jQuery works as intended, adding the email and date. With jQuery, the form submits successfully and returns the success message. However, no data is added to the database.
Any insight would be greatly appreciated!
<!-- PROCESS.PHP -->
<?php
// DB info
$dbhost = '#';
$dbuser = '#';
$dbpass = '#';
$dbname = '#';
// Open connection to db
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
// Form variables
$email = $_POST['email'];
$submitted = $_POST['submitted'];
// Clean up
function cleanData($str) {
$str = trim($str);
$str = strip_tags($str);
$str = strtolower($str);
return $str;
}
$email = cleanData($email);
$error = "";
if(isset($submitted)) {
if($email == '') {
$error .= '<p class="error">Please enter your email address.</p>' . "\n";
} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", $email)) {
$error .= '<p class="error">Please enter a valid email address.</p>' . "\n";
}
if(!$error){
echo '<p id="signup-success-nojs">You have successfully subscribed!</p>';
// Add to database
$add_email = "INSERT INTO subscribers (email,date) VALUES ('$email',CURDATE())";
mysql_query($add_email) or die(mysql_error());
}else{
echo $error;
}
}
?>
<!-- SAMPLE.PHP -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sample</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// Email Signup
$("form#newsletter").submit(function() {
var dataStr = $("#newsletter").serialize();
alert(dataStr);
$.ajax({
type: "POST",
url: "process.php",
data: dataStr,
success: function(del){
$('form#newsletter').hide();
$('#signup-success').fadeIn();
}
});
return false;
});
});
</script>
<style type="text/css">
#email {
margin-right:2px;
padding:5px;
width:145px;
border-top:1px solid #ccc;
border-left:1px solid #ccc;
border-right:1px solid #eee;
border-bottom:1px solid #eee;
font-size:14px;
color:#9e9e9e;
}
#signup-success {
margin-bottom:20px;
padding-bottom:10px;
background:url(../img/css/divider-dots.gif) repeat-x 0 100%;
display:none;
}
#signup-success p, #signup-success-nojs {
padding:5px;
background:#fff;
border:1px solid #dedede;
text-align:center;
font-weight:bold;
color:#3d7da5;
}
</style>
</head>
<body>
<?php include('process.php'); ?>
<form id="newsletter" class="divider" name="newsletter" method="post" action="">
<fieldset>
<input id="email" type="text" name="email" />
<input id="submit-button" type="image" src="<?php echo $base_url; ?>/assets/img/css/signup.gif" alt=" SIGNUP " />
<input id="submitted" type="hidden" name="submitted" value="true" />
</fieldset>
</form>
<div id="signup-success"><p>You have successfully subscribed!</p></div>
</body>
</html>
Hi,
I have apache and mysql set up on my local machine (Mac).
Whenever I go to any of my local sites I get the "Error establishing a database connection" whenever anything mySql related happens.
It was working perfectly yesterday, but when I started my computer today it is not.
I can login to mysql on the terminal and that all works fine, I can view database and run queries in the terminal. Look at all my table etc.
I've tried restarting apache.
Anyone know what's up? This is worrying.
I am working on a web application using Python (Django) and would like to know whether MySQL or PostgreSQL would be better when deploying for production.
In one podcast Joel said that he had some problems with MySQL and the data wasn't consistent.
I would like to know whether someone had any such problems. Also when it comes to performance which can be easily tweaked?
I have set a JDBCRealm for web-app inside tomcat, and when I reload it I got this from tomcat:
SEVERE: A web application registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
I use tomcat 6.0.24, with MySQL Connector 5.1.10,,,
I've got regexes inserted directly into a MySQL database, how do I convert html entities to their safe equivalents using a MySQL query?
EDI: The data is already in the database.
In a Django project, some cronjob programs are mainly used for administrative or analysis purposes, e.g. generating site usage stats, rotating user activities log, etc.
We probably do not hope MySQL to cache queries in those programs to save memory usage and improve query cache efficiency.
Is it possible to turn off MySQL query cache explicitly in those programs while keep it enabled for other parts including all views.py?
Is there a quick and easy way to backup both SQL Server 2008 and MySQL, all their databases?
Right now I have a batch script that runs, but I have to manually add a database each and every time, and I'm sick of maintaining it. So I want to set it up to backup all SQL Server and then all MySQL, I dont care if its two different solutions, just want the ability to backup all the databases without having to type them in.
Thank you.
Hi,
Would like to ask is there any way to synchronize Ms Access and mySQL but are hosted in different hosting.
If I update the Ms Access, the mySQL database in different Host is updated automatically.
Thank you.