Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x

MySQL Server

46K

Solutions

22K

Contributors

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

please provide the php code with mysql query to hide the message in an image using steganography
0
Moving data to the cloud? Find out if you’re ready
LVL 3
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

I suddenly can't seem to access my local websites on my Mac via MAMP. My ddns.log file contains the following:

mamp_dyndns[41389:21445531] DynDNS: [no update] empty username and/or password

Open in new window


I do have my DynDNS username and password stored properly in the MAMP interface, and my DynDNS account is in good standing and is configured as it's always been.

Any help on figuring this out would be appreciated.

Thanks,
Jon
0
I need a wocommece query which can return the following:

Product ID, Product Name, Product URL, Url of Featured Image,
where wp_postmeta.meta_key = _wc_dispatch_days and wp_postmeta.meta_value > 0
and
stock level > 0


the meta key _wc_dispatch_days is a custom key, and it hold values, for which i need records with values >0
0
hi,

I am testing situtaiton which make MySQL replication broke down and I have to resume it, e.g. ONLY after the weekend we know one MySQL node down and replication is not sync across all MySQL nodes.

A->B->C->A, when C is down and B has data changed but A can't receive it.

I am reading this:

https://stackoverflow.com/questions/2366018/how-to-re-sync-the-mysql-db-if-master-and-slave-have-different-database-incase-o
https://www.howtoforge.com/how-to-repair-mysql-replication

https://www.barryodonovan.com/2013/03/23/recovering-mysql-master-master-replication

https://dba.stackexchange.com/questions/45487/what-is-the-best-way-to-recover-from-a-mysql-replication-fail

what is the correct steps to make B and A sync first before C comes online again?
 assuming B and A does not have the same content now ?
1
I have seen a few questions like this and variations of this but I am still confused as how to go about doing this. I have different dealers in different regions and want to list them by region in one long list.

West Coast
dealer 1
dealer 2
dealer 3

East Coast
dealer 1
dealer 2
dealer 3

And so on...

I have a database table with a list of regions and another table with a list of dealers.

The dealer table has a column which contains the region id from the regions table so I can join the tables.

I tried this:

$stmt = $link->prepare("SELECT `region_name`, `dealer_name` FROM `dealer_region` as `dr` INNER JOIN `dealers` as `d` ON dr.`id` = d.`region_id` GROUP BY `region_name`");
$stmt->execute();
$result = $stmt->get_result();
$numRows = $result->num_rows;
if($numRows > 0) {
    while($row = $result->fetch_assoc()) {
        $dealer_name = $row['dealer_name'];
        $region_name = $row['region_name'];
        echo $region_name . "<br />" . $dealer_name . "<br />";
    }
}

$stmt->close();

Open in new window


But this only results in one dealer being shown under each region instead of all.
0
Hi Experts,

I have telerik:RadNumericTextbox inside Gridview control.
I want to update the textbox value into the database (on lost focus event or onclick of button) for particular record.

gridtext.JPGHow do I achieve the task?
(Using Javascript or without javascript.)

Regards,
D Patel
0
Hello experts,

Here is my code:

<input type="checkbox" name="seat_rented[]" value="<?php echo $row['seat_serial'];?>">
$n = count($seat);
foreach($seat as $x) {
    $pdf-> Write(0, $x . ", ");
} 

Open in new window

I only want to concatenate the comma when $n is >1. If $n equals 1, I want to concatenate a period. I can't think of the if or while statement to handle this...
0
I have an older XAMPP installation hosting one website that went down. I have backups that I created using mysqldump before the crash and was wondering if I bring up a new Linux, Apache, MySQL, PHP installation would it be possible to do a restore. What should I be looking out for before rebuilding this server? If the versions of the various components are different will that affect the recovery?Thanks.
0
Is there a tool out there for MySQL that will provide a gui and way of centrally managing users for a MySQL environment of 10 MySQL servers?

We would like a tool where our help-desk can enter a username, then select the 2 or 3 MySQL Server that the account needs to be created on, then check a few check boxes for the DB level permissions and then the user gets created on those 3 instances? Also, if we need to delete the user, we also need a way to remove the user from all servers he was deployed to.

It would be great if we could just select the user, then check a box that says "deactivate" or something like that and the tool then removes the user from everywhere it was originally deployed.

In the Microsoft world we have Active Directory...Not sure if AD works with MySQL, but that could also be an option....
0
Hello

I am trying to perform an Ms Access to mySQL migration as per this procedure.

Overall things seem to work as expected until I am prompted with this dialog (where I would be expecting my tables)
mdb
then the code seems to crash:

Starting...
Connect to source DBMS...
- Connecting...
Connecting to ...
Opening ODBC connection to DSN=product2013...
Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 5.2 CE\modules\db_generic_re_grt.py", line 634, in connect
    return GenericReverseEngineering.connect(connection, password)
  File "C:\Program Files\MySQL\MySQL Workbench 5.2 CE\modules\db_generic_re_grt.py", line 122, in connect
    con = db_driver.connect(connection, password)
  File "C:\Program Files\MySQL\MySQL Workbench 5.2 CE\workbench\db_driver.py", line 91, in connect
    connection = library.connect(connection_string, password=password)
pyodbc.Error: ('HY000', 'The driver did not supply an error!')

Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 5.2 CE\workbench\wizard_progress_page_widget.py", line 66, in run
    self.func()
  File "C:\Program Files\MySQL\MySQL Workbench 5.2 CE\modules\migration_schema_selection.py", line 150, in task_connect
    if not self.main.plan.migrationSource.connect():
  File "C:\Program Files\MySQL\MySQL Workbench 5.2 CE\modules\migration.py", line 180, in 

Open in new window

0
Veeam Disaster Recovery in Microsoft Azure
LVL 1
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Hello Experts,

Currently, my car seat return system looks like this:
Return Inventory
BUT, how would I accomplish something like this?
Table
I want to query the necessary tables. I want to display the renters' information from the renters table and the car seats they've currently rented from the rental agreement table.

I have the following MySQL tables:
  1. Renters (which contains all of the renters' information)
  2. Car Seats (which contains all of our car seats, and is used in an inventory application)
  3. Rental agreement (which contains information from the car seats and renters table)

Here's how my tables are structured:


Renters:
Renters

Car Seats:
Car Seats

Rental Agreement
Rental Agreement Structure
0
Example.jpg
This has me completely stumped. Clearly the result of the IF Statement is True, yet it's returning the False value.

Can someone please let me know what I'm doing wrong?
0
Hi experts,

I wrote this PHP code to update an analysis table on the server (Mysql) that displays monthly results from different categories.
In this example, I retrieve data from the costs table ('fin_costs') and put it into ('fin_analysis_2017')  in 2 separate rows, with the ID '16000' and '1000'.
Please find below the code.
https://gist.github.com/KlausA/phpcode

The issue is, that this code could be written in a more efficient way and let the server do more job instead of the browser, since I see all the queries have very similar structure. So, can you advice me how I could write this code in a simpler way?

Any suggestion/ example will be highly appreciated.
Thanks in advance!
0
hi,

what is the way to make Linux automatically start MySQL using the command I want whenever it restart?
0
Hi experts!

I recently created a LinkedService in Azure Data Factory to copy data from an on-premises MySQL databsae to a SQL Azure database. I followed the walktrought guide in the official Microsoft Azure documentation. However, when I check the Pipeline I notice it runs with no errors, an small 5 min. duration, but none row copied. So if I got to the LinkedService definition I notice an error saying "Credenciales no establecidas" ("Credentials not set").

Any advice on what is causing this error?

Please check in attachments screenshots of the error, as well as LinkedService/Data Copy Activity definition and Pipeline runs logs.

Help will be greatly appreciated.
Credentials-not-set.JPG
Logs-copy-activity.JPG
Linkedservice_definition.JPG
Copyactivity_definition.JPG
0
If a table has an auto increment field (column) & you delete ALL the rows the the table, then begin adding rows back, does the auto increment start over again at 1 (or zero) or does it remember the prior highest value & increment from there?

Thanks
0
Hi,
I am opening mysql with the command :
mysql
In it i type the following command :
mysql>  select * from information_schema.innodb_locks;
ERROR 1227 (42000): Access denied; you need (at least one of) the PROCESS privilege(s) for this operation

How do i resolve this error ?

Thanks
0
I have several existing tables reaching up to several million rows and I want to start adding partitioning to them. I took a smaller table with a couple thousand records as a test bed but not really sure how to perform this on existing tables.

My end goal is to create a partition for each month_year

IE: I would call the partition 2017_01 , 2017_02; etc and want data with the date range to be in each of those partitions.

Using MySQL 5.7 on a google cloud sql env.
0
I have an image update form, when I hard code the user_id it works fine, but when I set the user_id to a Get it echoes back but once it reaches the query it is blank:
<?php  
//include_once "connections/MyPDO.php";
$user_id =  $_GET['user'];
echo 'user:' .$user_id. '';
if (file_exists("images/profile/" . $_FILES["file"]["name"]))  
{  
echo $_FILES["file"]["name"] . " already exists. ";  
}  
else  
{  
move_uploaded_file($_FILES["file"]["tmp_name"],"images/profile/" . $_FILES["file"]["name"]);  
echo "Stored in: " . "images/profile/" . $_FILES["file"]["name"];  
$image="images/profile/".$_FILES["file"]["name"];
	
 define('DB_SERVER', xxx');
   define('DB_USERNAME', 'xxx'');
   define('DB_PASSWORD', 'xxx');
   define('DB_DATABASE', 'xxx');
   $link = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
// processing $_POST variables
	$sql = "UPDATE users SET 
       Image = '$image' 
      
	   WHERE UserID = '$user_id'";
	
//displaying the query
	
echo 'query:' .$sql;
//echo 'image:' .$image;
//running the query
mysqli_query($link, $sql);
	echo mysqli_error($link);
}  
?> 

Open in new window


This is what I am getting back:
user:Stored in: images/profile/IMG_0915.jpgquery:UPDATE users SET Image = 'images/profile/IMG_0915.jpg' WHERE UserID = ''

Yet when I navigate to the page the user_id is picked up
user:kvander
0
Free Backup Tool for VMware and Hyper-V
LVL 1
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

hi,

I am trying to start the MysQL backup but I can't find it.

the locate mysqldump shows me:

mysqldump location
but it can't be run as Linux say can't find this file:

bash: mysqldump: command not found...

Open in new window


any idea?
0
Hi,
I want to write a code to transfer amount from one account to another.
A table will store the amount corresponding to each.

Suppose this how i transfer amount of 10  from account named A to account B

boolean amountToAdd(changeBy, accountName ) {
I run the following query using jdbctemplate with autocommit = 0
update account
set amount = amount +changeBy
where name = accountName
}

Now in my java code i will have the above mentioned transaction like :

Boolean isdeducted = amountToAdd(-10, A);
 Boolean isAdded = amountToAdd(10, B);

if(isdeducted && isAdded) {
    perform commit on transaction;
} else {
    perform rollback;
}
The issue comes in case of multithreading.
Suppose two such transactions are in process.

transfer 10 from A to B and transfer 10 from B to A

suppose amount in A = 100 and B = 90 to begin with
T1
A = A - 10  = 90
T2
B = B-10 = 80

Now as T1 has locked table A and T2 has locked Table B what will happen in this case ??

Also there is a possibility the T1 and T2 are getting executed over the same connection to the mysql server.
Then there could be the case like :

T1
A = A- 10 = 90
T2
B = B-10 = 80
A = A+ 10 = 100 (the changes will be visible as we are on the same connection)
commit;
so now A = 100 and B = 80
But suppose now there is a failure in db or something due to which T1 couldnt proceed
Then what will the value of A will it remain 100 or will it be rollbacked to what it was before T1 began...
0
HI,
Going by normal terminology if suppose A transfers amount of 10 into account of B.
then i will run two queries
update A  set A = A-10
update B set B  = B -10
(just writing a pseudocode above for illustration)

will that be called a transaction ??

Also i see that transaction is a special keyword in mysql.
What does transaction refers to the thing that we start with start transaction or any set of statements or queries can also be called a transaction depending on some logic.
Thanks
0
Hi,
On mysql docs pages i see that innodb has row level locking. But i tried the following on my mysql.
openend mysql on two terminals so there were two different connections.

In one i set autocommit = 0
update accounts
set amount = 100
where name = "rohit";



Now initially the amount for rohit is 90

In the other terminal if i type the following query :
select * from accounts where name = "rohit"
It show 90 because the transaction on the other connection has not been committed;

but if now i type
update accounts
set amount = 200
where name = "mohit"

this halts here.

And if i type commit on the 1st terminal the 2nd terminal command executed. otherwise it just halts probably queued.
That means the table was locked...

Please help me understand the above behavior

Thanks
0
Hi,
I am opening the mysql client by typing mysql on my mac terminal and then the following  :

unable to user start transaction in mysql getting the following error :
mysql> start transaction
    -> update account_inno set amount = 300 where name = "robin";
ERROR 1064 (42000): 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 'update account_inno set amount = 300 where name = "robin"' at line 2
mysql>


The start transaction statement is failing.
what could be the reason for this. How do i correct it ?

Thanks
0
Hi,
I've attached a graphic of my current table. The 'id' is a 36 char primary column. Needs to stay that way.
I need to have an additional column that is auto incrementing (essentially the same as an ordinary auto increment id in a table using row number).
How do I add that? I'm paranoid to adjust the table without double-checking.

(PS: I'm using the new column that would contain the row number to create a unique url slug. The HexID pkg I'm using in laravel takes a column and creates a 6 character encoded value). Keeps users from simply guessing row numbers in a url). So column must be unique which is what I'd get with a row number column.

thanks in advance
table.jpg
0

MySQL Server

46K

Solutions

22K

Contributors

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.