MySQL Server

47K

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

MySql download

I am planing to downoad Mysql, however I see there are separate files to download. Mysql Installer,Connector,Workbench,Notifier.etc...
My objectif is to download Mysql and be able to connect  to it through its own GUI, also be able to  use a program language to connect to it programatically

any help ?

Thank you
0
Cloud Class® Course: Amazon Web Services - Basic
LVL 12
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

I have a MySQL database. When I fetch a specific record with "SELECT * from projects where pid = 40", I get the attached. Note the column bfh1 = "Y". I have a php program that reads the contents of the record & stores the results into a series of $_SESSION variables. That program, with echos added to see what is happening, is here:
<?php
error_reporting(E_ALL);
// load_proj.php
$pid = intval($_GET['ppid']);
$nosumm = intval($_GET['nosumm']);
$ddocs = $_GET['disp_docs'];
//echo "ddocs in load_projn = " . $ddocs . "<br>";
session_start();
include "db_connect_nb.php";
$qry = "SELECT * from projects where pid = " . $pid;
echo "proj qry= " . $qry. "<br>";
$res = mysqli_query($link, $qry);
$p = mysqli_fetch_array($res,MYSQLI_ASSOC);
echo "p[bfh1] = " . $p['bfh1'] . "<br>";
// set all the session stuff
$_SESSION['project'] = $pid . "~" . $p['project_name']; 
$_SESSION['cltype'] = $p['cltype'];
$_SESSION['class'] = $p['cltype'];
$_SESSION['wttp'] = $p['wttp'];
$_SESSION['liq_type'] = $p['liq_type'];
$_SESSION['liq_source'] = $p['liq_source'];
$_SESSION['pgrp'] = $p['pgrp'];
$_SESSION['flow'] = $p['flow'];
$_SESSION['flevel'] = $p['flevel'];
$_SESSION['access'] = $p['access'];
$_SESSION['model'] = $p['model'];
$_SESSION['net_price'] = $p['net_price'];
$_SESSION['total_price'] = $p['trade_price'];
$_SESSION['mtype'] = $p['Material'];
$_SESSION['afs'] = $p['AFS'];
$_SESSION['wof'] = $p['wof'];
$_SESSION['atra'] = $p['atra'];
$_SESSION['abf'] = $p['ABF'];
$_SESSION['spapp'] = 

Open in new window

0
Dear experts,
I have table named "followers"
I have information about users on that table. User's id, lattitude and longtitude and the date when the information is recorded on my table.
but it repetitives, same userid has more than one row. I need to select the last inserted userid with latitude and longtitude information.

I want to select the last recoreded userid with the lat, lng columns

My columns are:

id ( auto_increment )
userid
lat
lng
date (datetime)

thank you
0
I'm looking for MySQL query that will replace values in a certain column matching certain value
so in this example I'd like to replace only all ABC  values under only Column1 with say 123 and leave XYZ unchanged, CBD
ID | Column1| Column2
1 | ABC           | blah
2 | ABC           | blah
3 | XYZ            | blah
4 | CBD          | blah

Thanks!
0
hi,

I am checking the MySQL cluster evaluation guide and i has one terms :

"As MySQL Cluster stores tables in data nodes, rather than in the MySQL Server, there are multiple
interfaces available to access the database."

I think data nodes is MySQL server and MySQL cluster just consist of many MySQL servers, it seems not correct if, according to the statement above.. ?
0
Hi,

Right now want to setup MySQL cluster and MariaDB Galeria Cluster to test the product on how well it function, so in order to prepare for it.

1. How many redhat linux nodes on testing each of this?
2. Anything else needed?
3. no shared storage is needed as actually the testing should not have shared storage and we should try horizontal scale out.
4. anything we should test on  cluster ?
5. can we use only node with 1 x network card to install ProxySQL and test it?
1
Hi,

Right now want to setup MySQL cluster and MariaDB Galeria Cluster to test the product on how well it function, so in order to prepare for it.

1. How many redhat linux nodes on testing each of this?
2. Anything else needed?
3. no shared storage is needed as actually the testing should not have shared storage and we should try horizontal scale out.
4. anything we should test on  cluster ?
5. can we use only node with 1 x network card to install ProxySQL and test it?
0
Hello

What is the Best way to search multiple tables in a MySQL database for Multiple search Terms?

Some Notes
  1. Currently I have it working Fine in MS SQL but have to change to MySQL
  2. The Search is done by Calling a Stored Procedure/Routine
  3. I am using Dynamic SQL to enable all the Search Filter Options
  4. I am also using Parameters to protect against SQL Injection.
  5. Search Columns are both Varchar and Integer
  6. The Procedure is sent 10 search Terms that need to be searched for.

In MSSQL I can use Named Parameters but these aren’t available in MySQL so I would have to pass 60 Parameters to the Prepared Statement.
This would have the Potential for Errors – Ensuring that each Parameter is in the Correct Order!!

How should I do this?

Following it the MSSQL code.
DECLARE @SQLSelectFields NVARCHAR(MAX)	= ''
DECLARE @SQLString NVARCHAR(MAX) = ''
DECLARE @SQLFilter NVARCHAR(MAX) = ''
DECLARE @SQLTables NVARCHAR(MAX) = ''

-- Tables to Select From
SET @SQLTables = ' dbo.PURCHORD_HDR AS POH ' + ' INNER JOIN dbo.ppp_vw_Company C ON C.AccountID = POH.ACCNO AND C.AccountType = 2 '
				+ ' LEFT OUTER JOIN dbo.CONTACTS CO ON CO.SEQNO = POH.CONTACT_SEQNO '
				+ ' LEFT OUTER JOIN dbo.NARRATIVES N ON N.SEQNO = POH.NARRATIVE_SEQNO '


-- Min Fields for General Searching and use
SET @SQLSelectFields = ' POH.SEQNO, POH.STATUS, POH.ORDERDATE, POH.DUEDATE, POH.REFERENCE, POH.ADDRESS1, 

Open in new window

0
Hi,

Right now want to research about how vulnerability each major DB has :

1) MS SQL
2) MySQL
3) MariaDB
4) Oracle
5) DB2.

Other than NIST database : https://nvd.nist.gov/vuln/search.

What other source I can search on the number of vulnerability of each product in last 3 years and the result make sense ?  the source has to be trust able !
0
I'm converting several online forms from MSSQL to MySQL.  For the most part, it's pretty easy but I'm stuck on a 'last updated' trigger.  I want it to fire any time the content of a row is changed.  In MSSQL, the trigger was fairly simple:

UPDATE dbo.tbl_XYZ
SET lastModifiedDate = getDate()
WHERE ID in (SELECT DISTINCT ID from inserted)

Open in new window


Not having any luck with MySQL however. I do run a trigger to set a GUID when the data is initially submitted to the table and some research indicates that this might be a problem for any additional triggers, especially ones doing an update.  I'm stuck with:

UPDATE dbo.tbl_XYZ 
set tbl_XYZ.lastModifiedDate = CURRENT_TIMESTAMP

Open in new window


Which gives me an error saying "Can't update table 'tbl_XYZ' in stored function/trigger because it is only used by statement which invoked this stored function/procedure".  There is another trigger that creates a GUID when the initial record is inserted but the timing is different for each trigger.  The GUID trigger is set to work before insert while the other one is after update.

I hope someone can help me to understand a bit better and show me where I'm missing the boat with this.  All help is appreciated in advance.
0
Upgrade your Question Security!
LVL 12
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Hi,

I think i am missing something regarding joins and subqueries

SELECT 
	id, userId, status, resigned
FROM `groups-members`
WHERE groupId = :s AND userId = :ss
ORDER BY id DESC
LIMIT 1

where :s =1  AND :ss = 1

Open in new window


returns a correct dataset of

[id]             => 94
[userId]     => 1
[status]      => 1
[resigned] =>

Open in new window


If i change it to add this statement into a query like so
SELECT 
	r.userId
FROM groups AS s
JOIN `groups-members` AS g ON g.groupId = s.id AND g.userId = :ss
LEFT JOIN (
	SELECT 
		 userId, status, resigned
	FROM `groups-members`
	WHERE groupId= :s
	ORDER BY id DESC
	LIMIT 1
) AS r ON r.userId= g.userId
WHERE s.id = :s

where :s =1  AND :ss = 1

Open in new window


The single variable i am trying to get returns null

This is part of a larger query that iterates over all the members not just ID 1 (so the AS r.userId = m.userId is more like how it reads within the query where m. is the listing of members within a table) -> shouldn't matter

The reasoning for putting the above statement into a subquery is that i need to order the IDs desc.  If there is a better way to join a table and get the last id i am more than willing to change it.

Can you please point out what i am missing

Thanks in advance
0
hi,

As,

 MySQL community edition has No Packages to compatible with Oracle if Migrate from Oracle.
 MySQL community edition has  No PL/SQL stored procedures/functions to compatible with Oracle if Migrate from Oracle.
 MySQL community edition has No Sequences to compatible with Oracle if Migrate from Oracle.
 MySQL community edition has No Dynamic SQL to compatible with Oracle if Migrate from Oracle.

any work around on this ? can only rewrite, right?
0
hi,

As I know MySQL community edition only support basic SQL routing. e.g. no connection pooling, any work around for it?
0
Trying to Run a query using a linked server on my SQL.   Getting this error..  I tried removing the . dbo before the table name but that didnt help.  i am connecting to MYSQL

0
Hi,

I am trying to create an sql statement with a variable limit.

i have created the following statment. I prefer not to create a stored procedure

	SET @count = (SELECT COUNT( DISTINCT userId ) AS cnt FROM `groups` WHERE squadId = :i AND status = :s LIMIT 1);
					
	SET @limit = (@count * 3);
	
	SELECT
		t.id, t.entityId, t.typeId, t.date, t.name, t.completed IS NOT NULL AS completed,
		r.userId,
		y.type,
		p.name AS user, 
		a.taskId, a.completed IS NOT NULL AS player_completed,
		c.description AS priority, c.color
	FROM group AS s  
	JOIN tasks AS t ON t.typeId = s.typeId AND t.entityId = s.id AND t.status = :s
	JOIN types AS y ON y.id = t.typeId
	JOIN `groups` AS r ON r.status = :s AND r.squadId = t.entityId
	JOIN players AS p ON p.id = r.userId
	LEFT JOIN `internal-codes` AS c ON c.code = t.priority
	LEFT JOIN `tasks-assignment` AS a ON a.taskId = t.id AND a.userId = r.userId AND a.status = :s
	WHERE s.id = :i
	ORDER BY t.id ASC, user ASC
	LIMIT @limit;

Open in new window


i get the following  error
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@limit' at line 17

Open in new window


What am i missing?

Thanks in advanced!!!
0
hi,

how is the mobility solution for MySQL , any idea? seems never heard about that.
0
I have existing VB.Net code that Adds, Updates & Deletes records on a MySQL database.
It works fine, as is - but now I wish to change the table to include a photo in BMP format.
I've looked on the Internet & found code, but nothing seems to work.
So I've included the Add routine & Connection routine I'm using.
I'd also like to know the retrieval routine that would work.
'ConnStr Routine

    Public MySQLConnectionString As String = "server= www.a.com;user id=xxx ;password=password;database=test"
    Public conn As New MySqlConnection(MySQLConnectionString)
    Public cmd As New MySqlCommand
    Public dt As New DataTable
    Public da As New MySqlDataAdapter
    Public ds As New DataSet
    Public sql As String

    Public Sub New()

    End Sub


    'Insert/Delete/Update        

    Sub RunQuery(ByVal MySql As String)
        conn.Open()
        cmd.Connection = conn
        cmd.CommandText = MySql
        cmd.ExecuteNonQuery()
        conn.Close()
    End Sub



    'Run Select Query        

    Public Function GetRecords(ByVal MySql As String) As DataTable
        dt = New DataTable
        da = New MySqlDataAdapter(MySql, conn)
        da.Fill(dt)
        Return dt
    End Function


End Class


'**************************************************
'Add Click Routine
    Private Sub cmdAdd_Click(sender As Object, e As EventArgs) Handles cmdAdd.Click

        Try



            Dim result As New DialogResult

            result = MessageBox.Show("Add Data", "::

Open in new window

0
need a query for count of vehicles to be separated based on car ,motor,,lorry and bus..i have three  tables to be queried using payment ,transaction and  vehicle_ type  table
carpark_id -common key for all table.
transaction_id is common for payment and transaction table
Vehicle _type_id is common for transaction and vehicle type table
This query is only volume of car to be calculated on 1 day and plz check the query

SELECT Count(payment.amount)Volume,sum(payment.amount)Amount,count(description) from carpark_db.payment,carpark_db.transaction where payment.transaction_id = transaction.transaction_id and payment.carpark_id ='AMSDE5E27D5846D0B3F3A8BA4CA4C127' and payment.payment_date_time >= '2018-01-02 00:00:00'
and payment.payment_date_time < '2018-01-02 23:59:59' Innerjoin  carpark_db.vehicle_type on payment.vehicle_type_id = vehicle_type.vehicle_type_id where vehicle_type.description LIKE 'Car%'
0
Good morning, does anyone know if its possible to update a mysql date field to the last day of previous month? I can grab the new date in a select but cant figure out how to update?

SELECT
  paid,
  date_paid As 'Old PayDate',
  Last_Day(date_paid - INTERVAL 1 MONTH) AS 'New PayDate'
FROM
  tbl_invoice
WHERE
  paid = 1

Open in new window


This obviously doesnt work but if anyone knows a method would appreciate it.
UPDATE  tbl_invoice
SET     Last_Day(date_paid - INTERVAL 1 MONTH)

Open in new window

0
Cloud Class® Course: C++ 11 Fundamentals
LVL 12
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Hi,

I am curious about best practices

Scenario:
Want to be able to track group task and personal tasks

Details
  1. Group tasks are independent of personal tasks
  2. Group tasks can be assigned to a person
  3. Task assignments are only at the group level
  4. Personal tasks are automatically assigned to that user
  5. Personal tasks only apply to that person
  6. The columns within the tasks table would be identical for both personal and group with exception of the ID (group/user)

Im curious if it is better practice to great three tables like so

tables
  1. entity type (ex: 1 =  group, 2 = user)
  2. tasks -> add an additional field to compensate for entity type
  3. tasks-assignments

Or to separate the tasks table into two tables one for users and one for groups (assignments would only be associated to the second table)

Thanks in advance!!
0
Hi Experts

Could you point how to present and validate a combobox value by using CakePHP?

Accordingly to:
Data Model  - There's a FK from Usuarios table to Posts table
img002
The page's layout
 img004
View's code: add_with_validation.ctp
  <div class="posts form">
<p>
	This form is like the first one but here we validate that a post must have
	at least one tag.
</p>
<?php echo $this->Form->create('Post'); ?>
	<fieldset>
		<legend><?php echo __('Add Post validating the number of tags'); ?></legend>
	<?php
		echo $this->Form->input('name');
        
        // Tags correctly presented    
        echo $this->Form->input('Post.Tag',array('label'=>'At least one Tag', 'type'=>'select', 'multiple'=>true));
	
        
        //Code to present the Users combo (what I need to be done)
		echo $this->Form->input('Post.Usuario',array('label'=>'At least one Usuario', 'type'=>'select', 'multiple'=>true));
	?>
	</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
<div class="actions">
	<h3><?php echo __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('List Posts'), array('action' => 'index')); ?></li>
	</ul>
</div>

Open in new window


The correspondent controller's code
  public function add_with_validation() {
    if ($this->request->is('post')) {
      $this->Post->create();
      if ($this->Post->save($this->request->data)) {
        $this->Session->setFlash(__('The post has been saved'));
        return $this->redirect(array('action' => 'index'));
      } else {
        $this->Session->setFlash(__('The post could not be saved. Please, try again.'));
      }
      
    }
    $tags = $this->Post->Tag->find('list');
    $this->set(compact('tags'));
// I guess something must to be done here to consider "usuarios" - my tryes resulter in errors...

  }

Open in new window



Model's code
<?php
	
  App::uses('AppModel', 'Model');
/**
 * Post Model
 *
 * @property Tag $Tag
 */
class Post extends AppModel {

/**
 * Display field
 *
 * @var string
 */
  public $displayField = 'name';

/**
 * Validation rules
 *
 * @var array
 */
  public $validate = array(
    'name' => array(
      'notempty' => array(
        'rule' => array('notBlank'),
      ),
    ),
    
    // My Try to validate the usuario combo contents

        'Usuario' => array(
        'multiple' => array(
        'rule' => array('multiple', array('min' => 1)),
        'message' => 'You need to select at least one tag',
        'required' => true,
      ),
    ),
    
    'Tag' => array(
      'multiple' => array(
        'rule' => array('multiple', array('min' => 1)),
        'message' => 'You need to select at least one tag',
        'required' => true,
      ),
    ),
  );

Open in new window


Thanks in advance!
0
Hi Experts

Could you point a workaround to this CakePHP 2.10.10 session error ?

img001
0
How can i alter a stored procedure so that the Timestamp column enters current date and time in mysql?

My stored procedure takes data from a form input and inserts it into a table, it has a timetamp field generated by the server which is  passed to mysql,  but i want the database to use the NOW() function instead to generate the timestamp.

my stored procedure:
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_Data`(
       eCard longtext,
      _Timestamp datetime,
      Registration varchar(200),
    `Name` varchar(200))
BEGIN
      declare cID varchar(100);
      

    SELECT cID = `ClientID`  FROM `Clients`  where `Key` = eCard limit 1;

insert into Forms (
        `ClientID`
      ,`Key`
      ,'Timestamp'
      ,'Registration'
      ,`Name`
        )
        values
        (
        cID
        ,eCard,
       ,NOW() ----------> Here?
       ,Registration
       ,Name
          );
        
END

Where do i place the NOW() function ?
0
Hi Experts!

Could you point a good CakePHP Blog project with posts/ tags/ authors  to be used as a template?

Thanks in advance
0
Can someone please explain the point of NULL in database tables?

I have the option to set a field to be NULL if it is blank. Why would i do this, instead of just leaving it blank?
0

MySQL Server

47K

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.