MySQL Server





MySQL is an open source, relational database management system that runs as a server providing multi-user access to a number of databases. Acquired by Oracle in 2009, it is frequently used in combination with PHP installations, powering most of the WordPress installations.

Share tech news, updates, or what's on your mind.

Sign up to Post


usually in an MySQL Percona XtraDB Cluster, change schema is a nightmare, how you guys handle schema change for it?
Hi All,

Are there any major caveats to using .net entity framework with mysql? Ive found myself in an interesting scenario working on a project that uses .netframework+mssql as backend/api for a cross platform mobile app (native andoird and native ios).

App is hosted on azure hosted sql server but DB costs are getting very high. We received an offer to move the DB to another cloud service with generous credits, but of course they only have hosted mysql (or we would need to use VMs, licensing for mssql alone would eat benefits).

Our entire app runs super sleek everything through visual studios (no stored procs or views or triggers on db etc), so i was thinking we can change the VS db driver to MySQL and run our migrations on the new cloud service to recreate the database on mysql... then we can migrate the data over as well.

I eventually would like to convert the app to .netcore as well but dont think we will be able to do that right now, immediate concern is reducing the DB costs.

Is this a crazy idea or something that is viable?

I am new to cloud computing and have begun my self education by creating a tiny database in a Digital Ocean droplet. Creating and editing are no problem because I have set up SSH keys and distributed them properly (apparently) to the MySQL Workbench on my client PC.

My question: I would like to learn how to connect to my database on the Digital Ocean cloud server from applications that I write on my local client PC's using VB Script. I realize the scope of this question is broad; what I really need is pointed in the right direction. Can someone tell me what resources to use for learning how to do this?

I am fairly adept at manipulating remote databases in the way I described here - just never with databases in the cloud.

Any and all suggestions are welcome. Thank you in advance!


I would like to request an assistant.

I have huge data, the following are some sample of it :

customer_id | total | created_at | mmobilcart_id | store_id | status_id |
17  |  53    | 2019-01-01 06:42:10 | 7 | 8 | 1 |
25  |  120  | 2019-02-21 06:42:10 | 7 | 8 | 1 |
19  |  225  | 2019-03-23 06:42:10 | 7 | 8 | 1 |
13  |  57    | 2019-02-01 06:42:10 | 7 | 8 | 1 |
17  |  111  | 2019-02-11 06:42:10 | 7 | 8 | 1 |
19  |  85    | 2019-02-25 06:42:10 | 7 | 8 | 1 |
17  |  654  | 2019-04-11 06:42:10 | 7 | 8 | 1 |
13  |  25    | 2019-05-08 06:42:10 | 7 | 8 | 1 |
25  |  212  | 2019-02-18 06:42:10 | 7 | 8 | 1 |
17  |  8      | 2019-03-18 06:42:10 | 7 | 8 | 1 |

I would like to have the following output :

1. Total per "customer_id" .
2. Its rank based on "total" , the bigger total should be the 1st and so forth.

I have tried the following to list it :

SELECT customer_id, SUM(total) as TOTALS FROM mmobilcart_order WHERE created_at between '2019-01-01 06:42:10' and '2019-06-30 07:42:50' AND mmobilcart_id=7 AND store_id=8 AND status_id='1' GROUP BY customer_id ORDER by TOTALS DESC ;

But, i have problem to get its rank.

Can anybody assist me on this ?

I need to have solution either via MYSQL query or PHP.

Thank you.

I have been tasked with trying to recover data from a legacy service win2003/mysql5.4. the server file system has been damaged by ransomware, specifically Dragon4444, possibly MBR and/or individual file damage.

So I am guessing its more of a data recovery job, so if it proves possible to recover files from the mysql directory, does anyone know of a way to attempt to restore even the text contents? structure if possible. Or try to reconstruct on a spare machine ?

All passwords available.

thanks in advance

thanks in advance
Trying to transfer data from Microsoft SQL database (SQL_Latin1_General_CP1_CI_AS) into MariaDB using MySQL workbench but whatever i do i get "incorrect string value for column" errors on columns containing various user entered text with various characters, diacritics etc...
Tried MAriadb (Latin1, Latin2, UTF-8 charset)
Hi there - I have an urgent issue which could lose me a customer if I don't get it resolved this evening. Hope someone is able to help with this.

I had a new CentOS 7 server built for a customer and have moved all their websites to it. They are all Wordpress sites and all (on the old server) used to use MySQL databases. It was a CentOS 6 server. The new server uses MariaDB which I believe works the same as MySQL.

One of the files on the site has this PHP code in it:

        $dataHost_EMO = 'localhost:3306';
        $dataUser_EMO = 'overall_emo_adm';
        $dataPass_EMO = '@1}Zq!!?6]M?_EMO';
        $database_EMO = "overall_emo";

//      Connect to MEMBERS DATABASE
        $connect_EMO = mysqli_connect( $dataHost_EMO, $dataUser_EMO, $dataPass_EMO, $database_EMO );
        if (!$connect_EMO) { die('Connection to db failed because... '.mysqli_error( $connect_EMO ) ); }
//      else { echo "Connected to MEMBERS DATABASE"; }

        // echo "project_emo/connection_for_emo.php HAS BEEN INCLUDED"; 
        // die("TESTING Connection");


Open in new window

The error message "Connection to db failed because..." comes up. Head scratching moment.

I have made sure that the password matches the username in the config.php file and anywhere else I can find it, including in the above PHP code.

If anyone has a suggestion I would be so grateful!

Many thanks
I have a php program that, among other things, inserts data into MySQL database tables.

I am having an issue I have encountered before, I cannot remember the solution.

here is a code snippet that contains (I believe) the essence of the problem:

// sel_opts
	$qry = "INSERT into sel_opts (ruid, lowprosep, SRI, PGK, WOF, Fspool, GCS, GRCoup, hydroboosters, ehydroboosters, clips15, clips2, nozzles, bkwash, material, bkwhtank, hlctrls, typ, nct, selno) VALUES (" . $_SESSION['ruid'] . ", '" . $_SESSION['lowprosep'] . "', '" . $_SESSION['SRI'] . "', '" . $_SESSION['PGK'] . "', '" . $_SESSION['WOF'] . "', '" . $_SESSION['Fspool'] . "', '" . $_SESSION['GCS'] . "', '" . $_SESSION['GRCoup'] . "', " . $hb . ", " . $ehb . ", " . $clpsm . ", " . $clplg . ", " . $noz . ", '" . $_SESSION['bkwash'] . "', '" . $_SESSION['material'] . "', '" . $_SESSION['bkwhtank'] . "', '" . $_SESSION['hlctrls'] . "', '" . $_SESSION['typ'] . "', " . intval($_SESSION['nct']) . ", " . $selno . ")";
	echo "opts insert qry = " . $qry . "<br>";
	$res = mysqli_query($link, $qry);

Open in new window

I have attached the full program, if you need it.

The issue is this. Note the echo line. That line I inserted because the query was not inserting a row into that table. I thought the echo would show me the MtSQL, I could copy that to phpMyadmin & paste it there, finding the problem.

But the REAL problem is, inserting the echo makes the query work.

Commenting the echo out, does NOT insert.

I am sure there is a simple reason, as this is clearly impossible as I have described it.

Thank you

does mariaDB support java programming ?

I know oracle can .
Hi experts,

I came across a page on mysql which I can integrate memcache with mysql from

I wish to know if I really need to rebuild mysql in order to integrate and If so how can I rebuild mysql (I am new to rebuild mysql)

Also when I install libevent, it is already reside in my linux distro (CentOS7)

Finally where is the MYSQL_HOME/share located at? I was able to install the mysql 5.7 but wasn't able to retrieve the innodb_memcached_config.sql file.

Do I need to setup the memached server first as well? Thanks
I am using WordPress 5.1.1 with WooCommerce 3.6.1 and I have several links within a Maria db table that need to changed.  It seems I need a lookup table of some kind that will change the url to the correct one when it encounters an incorrect one. I have over 600 links that need to be changed and around 50 different url's that need to be substituted into the db.

Due to the volume of links I want to do this in a bulk manner.  

What is the best way to accomplish this?

If you could show me an example it would be helpful too.
Hi everyone, I'm creating an android app that allows people to register via FacebookAccountKit.

Facebook account kit gives me a Token when the user has been verified (via SMS).

I can't understand how I can secure registration and user data with the token.

I'll explain :

At the moment, when I need to get user data from the database and show it on the app, I use a hidden field to send the user ID to the PHP file to filter the data.

Many have told me that it is not recommended, they told me to send a Token to the PHP file and then get the user id.

I can't understand a few things:

1) The Token must be associated with the user's ID address, could I save them in the same table or could I do it in another way?

2) When the Token expires what happens? I have to log in the user again and save the new Token on the MySql table.
   But to do this I will have to specify that it will be saved in the line where the user ID is the same as the user ID and then send the user ID from the app again.

3) To log in, I request the phone number and the user ID, I will have to send them from the app to the PHP file that checks whether the user exists or not, but so I return to the initial problem, ie send the user's id and the phone number from the app to the PHP file.

Someone could clarify my confusion about this.

Do you recommend a more valid alternative for securing my users' data?

If you …
Automate filter in Opencart default template.
<script type="text/javascript">
$(document).ready(function() {
    // hide the "submit" button

    // bind onChange event to the checkboxes
    $('.click_checkbox_manufacturers-filter').live('change', function() {
        filter = [];

        $('.box-filter input[type=\'checkbox\']:checked').each(function(element) {

        window.location = '<?php echo $action; ?>&filter=' + filter.join(',');

Open in new window

I replaced with this code but it hide the refine search button but it is not giving the right result.
Now the refine button is hidden but not getting the right result. I want to update the filter when I tick the tickbox.
Is there anyone who can guide me to get the filter on check box event.
I have a problem that I can't solve.

I am creating an Android App where there is a section showing user data.

The data is saved on a MySql database through Register.php and to get them use the Show.php file.

When I open the user activity in the app, there is a hidden field that contains the user's id, the app sends the id to the Php script and shows all the data of that user.

The problem is that the data is shown with a bit of delay, because it has to read the id from the app and show the filtered data.

What I would like is that in the Php file there was already the user id, so the display of the data on the app would be instantaneous, because so I already have the value of the variable that contains the id to use then in the Query.

To do this I thought of using sessions.

But it does not work.

In the Register.php file I inserted a session variable to store the value of the variable id_restaurants that I need in the show.php script to show that user's data through a Query.

But in the Register.php file it seems that the value of the variable $ _SESSION ['varId'] is not saved.

What am I doing wrong?

Here is the registration file: Register.php





    $idUser = $_POST['idUser'];
    $name = $_POST['name'];
    $surname = $_POST['surname'];
    $restaurant = $_POST['restaurant'];
    $id_restaurant = $_POST['id_restaurant'];


Open in new window

I am working through a production issue where the client company migrated from MySQL v5.6  (AWS RDS)  to   Aurora  (AWS), and the MySQL version is 5.7. Initially the migration worked, but ran into locks on the Aurora engine, within 24 hours.

I am looking for the best practice scenario for this migration, and recommendations.
I am running wordpress 5.1.1 and WooCommerce 3.6.1 on a LInux 2 Amazon instance and I had a message that my db needed to be updated for WooCommerce. I opted to begin the process and this message popped up.

WooCommerce database update – WooCommerce is updating the database in the background. The database update process may take a little while, so please be patient. 

Open in new window

This message has been up for 24 hours now and I have a small store of 1400 sku's.

I have attempted the following:
1. restarted maria
2.  deactivated and activated woocommerce
3. checked the memory in wp-config which is set at 1024 MB
4. restarted Apache

How can I get rid of this message?  If the message isn't a problem how can I be assured the db integrity is intact?

How do I zip Mysql database as I have to zip my project in visual studio along with database file.

Thanks in advance
Create table from another with same structure

According to MySQL docs:

CREATE TABLE new_tbl [AS] SELECT * FROM orig_tbl;

I tried this in phpMyadmin, as in the attached.

How do I make this work
Hi Experts
I have a situation where i need to write a query to create multiple database in mysql.
For example i have database = (test,test1,test3)
How to write a mysql statement for create database
Create database test,test1,test3, How can i loop on my condition and create multiple databases.
Thanks in advance.

what kind of database management tools you guys can suggest for mariaDB ?

we are migrating from Oracle to MariaDB and because of the tools limitation, we can see that some tools, like mySQL workbench can't see all index migrated but some of the index can be seen from Toad for MySQL. but not all information like constraint can be seen from Toad for MySQL.

please suggest,
Assistance in writing a script that will:-

a) backup mySQL databases at 00:01, together a log to state that backups are completed successfully or failed and and e-mail notification is sent out
b) mySQL databases are kept for 7days before they are archived
In the code below I am using a CSV file and creating a temporary table, and then using an inner join to update a field where the SKU is matching.
DROP TABLE IF EXISTS oc_product_import; 
CREATE TABLE oc_product_import LIKE oc_product;
LOAD DATA INFILE '/var/lib/mysql-files/out.csv'
       INTO TABLE oc_product_import 
       (sku, quantity);
UPDATE oc_product AS R 
INNER JOIN oc_product_import AS P 
      ON R.sku = P.sku 
SET R.quantity = P.quantity; 
DROP TABLE oc_product_import;"

Open in new window

This works fine for me my current purposes. But now I have two tables, TABLE1 has the QUANTITY, and an ID. TABLE2 has an ID, and a SKU. I want to update the quantity using the SKU’s from my CSV as i’ve done before but have to reference it by this ID in another table. That’s the part I don’t know how to do. If my question is confusing please ask a follow-up.
I am trying to pass a number with a decimal point as a part of a query string with this Javascript:

sname =; = "sel_save.php?sname=" + sname + "&tptot=" + encodeURI(tptot);
			return true;

Open in new window

Here is what the url looks like:

It seems obvious to me that the . in the number is screwing things up.

In save_sel.php, I do this: $tptot = urldecode($_GET['tptot']);

Later on, I am trying to insert a record (row) into a MySQL table, like this:

$qry = "INSERT into selections (ruid, sel_name, date, cltype, length, width, depth, flow, sspct, pgroup, access, flevel, model, purge_method, tpurge, voltage, pepump, pumprepair, valve_kit, dec_contact, multi, repl_bags,strainer, net_price, ssgroup) VALUES(" . $_SESSION['ruid'] . ", '" . $sel_name . "', '" . date('Y-m-d') . "', '" . $_SESSION['cltype'] . "', " . $length . ", " . $width . ", " . intval($depth) . ", " . intval($flow) . ", " . intval($sspct) . ", '" . strtolower(substr($_SESSION['model'],0,3)) . "', '" . $_SESSION['access'] . "', " . intval($_SESSION['flevel']) . ", '" . $_SESSION['model'] . "', '" . $_SESSION['purge_method'] . "', '" . $_SESSION['purge'] . "', '" . $_SESSION['voltage'] . "', '" . $_SESSION['pepump'] . "', '" . $_SESSION['pumprepair'] . "', '" . $_SESSION['valve_kit'] . "', '" . $_SESSION['DEC'] . "', '" . $_SESSION['multi'] . "', " . $replbags . ", '" . $_SESSION['strainer'] . "', " . $tptot . ", '" . $_SESSION['group'] . "')";

Open in new window

I echo the $qry, $tptot is null, so the insert fails.

How can I fix this?

Thank you.
I have 6 tables in a MySQL database. I want to copy the table structure of these 6 to another existing database.

Initially, there will be O data in any of these tables.

Can I do this using phpMyadmin? If not, how else?

Hi Experts,

I'm in need of a PHP solution that will emulate the import function of PHPMyAdmin.

The import should parse an Excel file, then use the first row within the Excel file as the column names of the DB table, then insert each row of the Excel document into the table.

I've seen many solutions out there which allow PHP to import an Excel file but, the catch with these solutions is that you must create the data table first, then use PHP to parse and insert the data. In my circumstance, I won't know how many columns exist within a spreadsheet that is being imported. I need PHP to figure how many columns should exist in the table, and what data types they are, then create the columns and insert each row of data into the table (this may not be correct programming logic).

Does anyone know of any snippets of code or, third party libraries that may accomplish this task?


MySQL Server





MySQL is an open source, relational database management system that runs as a server providing multi-user access to a number of databases. Acquired by Oracle in 2009, it is frequently used in combination with PHP installations, powering most of the WordPress installations.