MySQL Server

47K

Solutions

23K

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

I have inherited a program where the date field in a MySQL table is really a VARCHAR field.  The date looks like this string:  1260777185.  I can't change the format of the field because of various reasons.  How can I change/convert this field to a date format in my query?  It needs to be done at the query level.  The field is called timestamp.  

I'm using this query, but the field is blank once the query has been run.

SELECT amount, description, STR_TO_DATE('timestamp', '%m/%d/%Y') AS transdate FROM transactions

Thank you.
0
Hi, im having a hard time removing these, these files are huge

#sql-df3_13ba706.frm  
#sql-ib500.ibd  

I've tried drop table '#mysql50##sql-df3_13ba706';

and mysql pretty much says I dont know what Im doing...

#1064 - 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 ''#mysql50##sql-df3_13ba706'' at line 1
0
my table looks like this

dt        ticker         open
1            A                1.2
1            B                 6
2            A                 1.4
2            B                 6.5

I would like it to turn out to be

dt           A            B
1            1.2         1.4
2            6            6.5

I tried using mysql query in below format

SET @sql = NULL;
SELECT
GROUP_CONCAT(DISTINCT
CONCAT(
'MAX(IF(ticker= ''',
ticker,
''', open, NULL)) AS ',
ticker
)
) INTO @sql
FROM properties;
SET @sql = CONCAT('SELECT dt, ', @sql, ' FROM properties GROUP BY dt');

while executing the query in phpmyadmin I am getting below error .

Warning in .\libraries\dbi\DBIMysqli.php#436
mysqli_fetch_fields() expects parameter 1 to be mysqli_result, boolean given.


      
below are additional error messages :-

 the query is executing ,but looking into rows i am getting errors Backtrace .\libraries\dbi\DBIMysqli.php#436: mysqli_fetch_fields(boolean true) .\libraries\DatabaseInterface.php#2641: PMA\libraries\dbi\DBIMysqli->getFieldsMeta(boolean true) .\libraries\sql.lib.php#1848: PMA\libraries\DatabaseInterface->getFieldsMeta(boolean true) .\libraries\sql.lib.php#2199: PMA_getQueryResponseForResultsReturned( boolean true, array, string 'qc', string 'tbl_main', NULL, NULL,

I am stuck with this , can anyone guide me with the solution
0
The  following SQL query returns the field names of a certain table in my database.

    /* Build static SELECT Query string
             Get all column names from table tbl_mainsheet7...
             NOTE Back-Quotes around `COLUMN_NAME` & `TABLE_NAME`
             These allow for special characters in field names. */
          SELECT `COLUMN_NAME`, `COLUMN_COMMENT` FROM INFORMATION_SCHEMA.COLUMNS WHERE `TABLE_NAME` = 'tbl_mainsheet7'

Open in new window


The thing about it is that I need the field values for that field to be returned as well. As you can see I can only get the field_name and field_comment since I am currently querying a system table.

**Question**

How can I run a SELECT query **DIRECTLY on tbl_mainsheet7** and return a single result displaying the **field_name** | **field_value** | **field_comment** ?
0
I have multiple tables in a database. Each table contains race results for a given year.

The tables contain 10 columns including surname VARCHAR), dob (VARCHAR) and pin3 (INT)

I need a query that will do the following:-

Find records (matched on surname and dob) that appear 3 times or more across all of the tables AND where pin3 does not equal "1"
0
I have a simple custom post type for events.

Added Meta Boxes with data:
start date and time
End date and type
Recurring option drop down: daily, weekly, monthly, yearly
Recurring end date

Meta gets stored in the wp_postmeta table.  Example image:
wp_postmeta for single event post
So, im looking to setup a query to get events within a range and also have the recurring events listed as rows.  so i can loop through on a page and other things.

Thoughts?
0
How to enable Mysql server access through TCP/IP
where mysql installed in Centos machine.,.I am trying to access using mysql workbench it through TCP/IP but throwing error .. attached screenshot.
Where as when I select TCP/IP over SSH .. I can able to connect .
mysql-TCPIP.jpg
0
I am currently trying to develop a database for simultaneous remote user access (not a LAN network). From what i've researched, im going to do the LAMP stack (Ubuntu 16.04 server, Apache, MySQL and PHP). However, would this force the 10 end users to enter data through php and then I would have to connect the PHP forms to MySQL database? Can end users manage to see the tables this way or edit changes to database once they submit the forms?  Thanks for your help!
0
i want to get month (last 12 month) + current month and my date is in string.

SELECT pd.DC_Date,sum(pd.Quantity-pd.Credit_Quantity) AS 'Sales'
FROM past_year_data pd
JOIN idash_tb2_product_list PL ON PD.Product_Name=PL.Product_Name
WHERE pd.Branch_Name = 'Delhi' AND
STR_TO_DATE(DC_Date,'%m')  BETWEEN DATE_ADD(NOW(), INTERVAL -12 MONTH) AND NOW();

I have use this query but didn't get any value
0
Hello ,
I am setting up mysql replication between a master and slave and I get the error "error connecting to master".

Before i have this error 1045, i use this solution tutorial:
https://www.howtoforge.com/how-to-repair-mysql-replication
After that have nothing change.
I tried to change my password form the slave-user but nothing change.

I have in the my.ini datei on slave the id=2 and on master the id=1

 i have the user for the replication in the php-admin and i gave him the right for the replication.

The Port: 3306 is open:

Starting portqry.exe -n 11.1.1.1.1.11 -e 3306 -p TCP ...

Querying target system called:

1.1.1.1.1.1

Attempting to resolve IP address to a name...

IP address resolved to master.net

querying...

TCP port 3306 (unknown service): LISTENING
portqry.exe -n 11.11..1.11.1 -e 3306 -p TCP exits with return code 0x00000000.

How i can test the rights best about the user slave?


mysql> SHOW SLAVE STATUS \G;
* 1. row *
Slave_IO_State: Connecting to master
Master_Host: Master.host.net
Master_User: slave_sync
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000005
Read_Master_Log_Pos: 8127820
Relay_Log_File: relay.000024
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000005
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Replicate_Do_DB: db_01
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
0
Hello,

I am getting following error while starting phpmyadmin.

 MySQL said: Documentation
#2002 - Connection refused — The server is not responding (or the local server's socket is not correctly configured).
mysqli_real_connect(): (HY000/2002): Connection refused
Connection for controluser as defined in your configuration failed.
mysqli_real_connect(): (HY000/2002): Connection refused
0
Hi,
I am developing a small friend contact list for my personal website, wherein I want my friends to update their personal details, like address, city, phone number, email address etc. after login.
There are fields like address, city, phone No., email, which is editable and fields like Names are not editable.
Flow:
login.php-->mainpage.php [where all the fields are getting displayed in column-wise like:
      First Name:
      Last Name :
      Address     :
      City             :
      Phone        :
      Email         :

To edit or update the details, I create a link 'EDIT' Button and link it to a page 'edit_profile.php', where I want my friends to update their latest information. But, the code is not working - I am developing this myself with the help of Internet. May I request you to kindly look into this and correct, it would be a great learning experience for me.

[edit_profile.php] is attached below:
<?php
session_start();
$first_name = $_SESSION['first_name'];
$last_name  = $_SESSION['last_name'];
$Fri_Add1  = $_SESSION['Fri_Add1'];
$Fri_City  = $_SESSION['Fri_City'];
$Fri_Phone1  = $_SESSION['Fri_Phone1'];
$Fri_Email1  = $_SESSION['Fri_Email1'];


if(!isset($_SESSION['restrict'])){
header("Location: ../login.php");
}

include "database/friends.php";
$sqlInfo = mysql_query(" select * from `friends`");

if(isset($_POST['updateMessage'])){

include 'database/friends.php';
$updateMessage = trim($_POST['updateMessage']);
$first_name = …
0
Have a problem getting a stored procedure to work in Adminer
This fails on the first line
Comments / tips very welcome

DECLARE @new_project_id int;
DECLARE @current_snapshot_id int;
DECLARE @new_snapshot_id int;

insert into project select * from project where project_id=@in_project_id
SET @new_project_id = last_insert_id()
for each row in (select * from snapshot where project_id=@in_project_id)
  insert into snapshot values(
       @new_project_id, 
       last_update	 
       snapshot_date 
       snapshot_title	 
       snapshot_note
)
 SET @new_snapshot_id = last_insert_id()
  insert into layer select new_snapshot_id, * from layer where snapshot_id =row.snapshot_id
loop

Open in new window

0
I  have developed free radius management system locally.
but now in my job they asked me to make this system to be selling in a cloud
ie. every user around the world can access our management system from the cloud
he must register a new account in our system and determine his database
that means every user has a different database with same free radius server
my first problem is when a new user had registered to our system his database information will go in SQL.conf file but as we know that free radius does not take his new configuration till restart so I must restart free radius for every new user and interrupt the others work.
the other question is when there are many users with their database for example if I have 100 users and for every user, there is one database that means free radius must connect to 100 different databases  is this will make free radius working slowly or not
I hope I explained my problem clearly
0
<Details>
    <Levels>
        <Level>
            <SectionId>681</SectionId>
            <RiskId>0</RiskId>
            <WAC>Test </WAC>
            <DOCReview>Test</DOCReview>
            <MAT>1</MAT>
            <SDV>1</SDV>
            <Questions>
                <QuestionId>1186</QuestionId>
                <QuestionId>1187</QuestionId>
            </Questions>
        </Level>
        <Level>
            <SectionId>681</SectionId>
            <RiskId>1</RiskId>
            <WAC>Test </WAC>
            <DOCReview>Test</DOCReview>
            <MAT>2</MAT>
            <SDV>2</SDV>
            <Questions>
                <QuestionId>1186</QuestionId>
                <QuestionId>1187</QuestionId>
            </Questions>
        </Level>
        <Level>
            <SectionId>681</SectionId>
            <RiskId>2</RiskId>
            <WAC>Test </WAC>
            <DOCReview>Test</DOCReview>
            <MAT>1</MAT>
            <SDV>3</SDV>
            <Questions>
                <QuestionId>1209</QuestionId>
                <QuestionId>1210</QuestionId>
            </Questions>
        </Level>
        <Level>
            <SectionId>681</SectionId>
            <RiskId>3</RiskId>
            <WAC>Test </WAC>
            <DOCReview>Test</DOCReview>
            <MAT>2</MAT>
            <SDV>1</SDV>
            <Questions>
                <QuestionId>1186</QuestionId>
                <QuestionId>1187</QuestionId>
                …
0
hi experts my code is like that check on table1 if textbox1.Text exist if yes go to table2 and check if textbox1.text exist and if textbox2.Text exist if they exist open the form if not insert them and open the form and if textbox1.text exist and textbox2.text doesn't exist close form

i wrote this :

MySqlConnection con = new MySqlConnection(connectionString);
            i = 0;
            con.Open();
            MySqlCommand cmd = con.CreateCommand();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select * from informat where u_ser = '" + metroTextBox2.Text + "' ";
            cmd.ExecuteNonQuery();
            DataTable dt = new DataTable();
            MySqlDataAdapter da = new MySqlDataAdapter(cmd);
            da.Fill(dt);
            i = dt.Rows.Count;
            int userial = metroTextBox2.Text.Length;
            if (userial >= 5 || metroTextBox2.Text == null)
            {

                MySqlConnection conet = new MySqlConnection(connectionString);
                conet.Open();
                MySqlCommand cmsd = conet.CreateCommand();
                cmsd.CommandType = CommandType.Text;
                cmsd.CommandText = "select * from alred  where u_ser = '" + metroTextBox2.Text + "'and u_ip =  '" + textBox1.Text + "'";
                cmsd.ExecuteNonQuery();
                DataTable ddts = new DataTable();
                MySqlDataAdapter ddas = new MySqlDataAdapter(cmsd);
                ddas.Fill(ddts);

         

Open in new window

0
I Created a form submitting data in a MySQL database

Now I try to get the following done.

To fill automatically some of the fields depending on the values in a previous field.  

Example: i have 3 fields

Firstname: ......
LastName: ......
UserName: .....
address: ......

All information is known in the db so when typing in the FirstName the LastName and  Username should automatically come up and be filled.

Thanks
0
In our environment all other jobs runs just fine but two jobs fails with ERROR" executed as user : \sqlserver [SQLSTATE HY000] (Error 596) "  then it fails the Cluster with Error

Cluster resource 'DWHAOGRP01' of type 'SQL Server Availability Group' in clustered role 'DWHAOGRP01' failed.

Based on the failure policies for the resource and role, the cluster service may try to bring the resource online on this node or move the group to another node of the cluster and then restart it.  Check the resource and group state using Failover Cluster Manager or the Get-ClusterResource Windows PowerShell cmdlet.
i have been looking everywhere but couldnt find any answer - tried rebuilding indexes broken the replica for that particular DB and also changed the user which executing this job .

Noting worked , please Help !!!
0
I have a web page that is divided into different sections. Each section has to show different results. These results are gotten from the database and from two different tables. The sections are gotten from a different table whereas the names are gotten from another table using the section as a secondary key

This is the expected result from the database
Section A
1 Adam Smith
2 John Smitherine
3 Mart Michael

Section B
1 John Doe
2 Bill Moe
3 Jane Bo

Section C
1 Jerome Park
2 Billy Zark
3 Marto Bark


So I came up with this
$section = $connect->query("SELECT section FROM Main_Section ");
while ($row = $section->fetch_array(MYSQLI_BOTH))
{
    $section_name = $row["section"];
    $name_result = $connect->query("SELECT id, firstname, lastname FROM Names WHERE section ='".$section_name."'");       
          while ($row1 = $name_result->fetch_array(MYSQLI_BOTH))
      {      
        $first_name = $row1["firstname"];
      $id = $row1["id"];      
      $last_name = $row1["lastname"];       
      $name_data  .= '<div>'.$id.' <div><h3>'.$first_name.' '.$last_name.'</h3></div></a></div>';                
                           
    }
$grand_data .= '<div class="box"><div class="sub-box"><h2>'.$section_name.'</h2></div>'.$name_data .'</div>';
}



on the html, I post the data by using

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>My Title</title>
  <meta name="description" content="My description">
</head>

<body>
  <?=$grand_data ?>
</body>
</html>

Here's the …
0
I work in php and mysql. In the site i have a search box. For Example: when i putting a skills i get around 100 data i further refine by putting in another skills   and the 100 is reduces  to 75. from 75 i further reduces and this process goes on till i have around 10 or 15 data.

This is a my search form.

search-form.png
if u have any example or any link please give me and help me.
Thank You
0
Hi, I'm trying to set up a website template with OpenCart integrated on my hosting server. It gets to step 3 and when I submit it gives a blank page. I switched on error reporting and I get this:


Fatal error: Uncaught Exception: Error: Access denied for user 'flowers'@'%' to database '614'<br />Error No: 1044<br /> CREATE DATABASE IF NOT EXISTS `614` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; in /var/www/flowers.co.uk/www/html/system/library/db/mysqli.php:40 Stack trace: #0 /var/www/flowers.co.uk/www/html/system/library/db.php(16): DB\MySQLi->query('\nCREATE DATABAS...', Array) #1 /var/www/flowers.co.uk/www/html/install/model/install/install.php(26): DB->query('\nCREATE DATABAS...') #2 /var/www/flowers.co.uk/www/html/system/storage/modification/system/engine/loader.php(150): ModelInstallInstall->database(Array) #3 /var/www/flowers.co.uk/www/html/system/engine/proxy.php(13): Loader->{closure}(Array) #4 /var/www/flowers.co.uk/www/html/install/controller/install/step_3.php(11): Proxy->__call('database', Array) #5 /var/www/flowers.co.uk/www/html/system/storage/modification/system/engine/action.php(44): ControllerInstallStep3->index() #6 /var/www/flowers.co.uk/www/html/system/engine/front.php(34): Action->exe in /var/www/flowers.co.uk/www/html/system/library/db/mysqli.php on line 40

Any ideas on what's going on here would be appreciated.
0
Hi all,

please check this below link for reference
https://www.indiafilings.com/find-gst-rate

I want to make same search and browse page how to make please help.
0
Hi
I wrote this stored procedure, but keep getting the missing 'end' error on the update query and i am lost as to why. Below is the Sp.
Also i am trying to loop in a cursor and get new tables created with each loop with the macro and macrolocation variable names as it gets. Is the syntax correct?


create procedure macroselected(IN macrosel int)
begin
declare macroval varchar(100);
declare macrolocation varchar(100);
declare macroid int;

select macroname into macroval from macro where macro.idmacro=macrosel;
update orgdetails set macroselected = macrosel where id=1;  (here is the error message for missing 'end' showing)

declare macrocur cursor for
select locationid,location from location;
declare continue handler for not found
set done=1;

open macrocur;
read_loop:loop

fetch from macrocur into macroid,macrolocation;
if done then leave read_loop; end if;

create table macro_macrolocation(macroid int not null auto_increment,macroyear varchar(300),macrostatus varchar(300));

end loop read_loop;
close macrocur;

end
0
Hi,

I've a 30 MySQL table on a AES EC2 Instance that I want to import into DynamoDB.
Could someone help me with the process.

DDL Information


Create Table

CREATE TABLE `AUDIT_ACTIVITY_LOG` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `ACTIVITY_ID` int(11) NOT NULL COMMENT 'Activity group id',
  `LOG_TIME` datetime NOT NULL COMMENT 'Logging time',
  `USER_ID` int(11) DEFAULT NULL COMMENT 'User who performed the task can be system performed task',
  `MG_ID` int(11) DEFAULT NULL COMMENT 'Merchant Group Id',
  `ACTIVITY_TEXT` text COMMENT 'Activity text should be populated form text',
  `IP_ADDRESS` varchar(50) DEFAULT NULL COMMENT 'Stores the ip address for the activity.',
  `REF_ID` int(11) DEFAULT '0' COMMENT 'The ref id to store some ids like order id or any other id to make search fast',
  PRIMARY KEY (`ID`,`LOG_TIME`),
  KEY `idx_LOG_TIME` (`LOG_TIME`),
  KEY `idx_ACTIVITY_ID` (`ACTIVITY_ID`),
  KEY `idx_REF_ID` (`REF_ID`),
  KEY `idx_MG_ID` (`MG_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=54920993 DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (YEAR(LOG_TIME))
SUBPARTITION BY HASH (MONTH(LOG_TIME))
SUBPARTITIONS 12
(PARTITION p2012 VALUES LESS THAN (2012) ENGINE = InnoDB,
 PARTITION p2013 VALUES LESS THAN (2013) ENGINE = InnoDB,
 PARTITION p2014 VALUES LESS THAN (2014) ENGINE = InnoDB,
 PARTITION p2015 VALUES LESS THAN (2015) ENGINE = InnoDB,
 PARTITION p2016 VALUES LESS THAN (2016) ENGINE = InnoDB,
 PARTITION p2017 VALUES LESS THAN (2017) …
0
Long Title, but that is exactly what I am trying to do.

I need a php script that will insert all of the inputs to a mysql table, I have tried to make one using a variety of methods, but none have worked, or they would insert the last value into the table.


Currently I have this HTML code:
		<table id="register">
		<form action="processing_games.php" method="post"/>
		<tr>
			<td><p>Date<br>(m/dd/yy)</p></td>
			<td><p>Time<br>(h:mm AM/PM)</p></td>
			<td><p>Opponent</p></td>
			<td><p>Location<br>(Rink Name)</p></td>
			<td><p>Conference<br>Game?</p></td>
			<td><p>Home or Away<br>Game?</p></td>
		</tr>
		<tr>
			<td><input type="date" name="inputs[0][date]"></td>
			<td><input type="time" name="inputs[0][time]"></td>
			<td><input type="text" name="inputs[0][opponent]"></td>
			<td><input type="text" name="inputs[0][location]"></td>
			<td><input type="radio" name="inputs[0][conference]" value="+"> Conference
			<br>
			<input type="radio" name="inputs[0][conference]" value=""> Non-Conference </td>
			<td><input type="radio" name="inputs[0][home_away]" value=" vs "> Home
			<br>
			<input type="radio" name="inputs[0][home_away]" value=" @ "> Away</td>
		</tr>
		<tr>
			<td><input type="date" name="inputs[1][date]"></td>
			<td><input type="time" name="inputs[1][time]"></td>
			<td><input type="text" name="inputs[1][opponent]"></td>
			<td><input type="text" name="inputs[1][location]"></td>
			<td><input type="radio" name="inputs[1][conference]" value="+"> 

Open in new window

0

MySQL Server

47K

Solutions

23K

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.