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'm on centos7, mysql8

Mysocial engine complaining that it can't login to the mysql database using the root login

I'm trying to login
# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


I of course went through the mysql8 documentation https://dev.mysql.com/doc/refman/8.0/en/changing-mysql-user.html

I also asked this question before but I tried the steps and it didn't work, I think it fails upon restarting my machine... how do I get a permanent solution to this?
https://www.tecmint.com/reset-root-password-in-mysql-8/ is what helped me last time.. but it is not working
0
Can I use visual basic for apps with mysql? I have worked with access and am new to mysql. In access I could code in vb to perform a task. I am not sure if I can do this in mysql.
0
Can you please help me in that error.
screenshot2.JPGscreenshot.JPG
<?php
$user = "root";
$passwd = "";
$dsn      = 'mysql:host=localhost;dbname=coffeedb;charset=utf8mb4'; 
$options  = [
    PDO::ATTR_EMULATE_PREPARES   => false,
    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ,
];

$db = new \PDO($dsn, $username, $passwd, $options);
?>

Open in new window


<?php
require 'Credentials/credentials.php';
$coffee = new CoffeeModel($db);

var_dump( $coffee->GetCoffeeTypes() );
var_dump( $coffee->GetCoffeeByType('sometype') );
require ("Entities/CoffeeEntity.php");

//Contains database related code for the Coffee page.
class CoffeeModel {

    private $db;

    public function __construct(\PDO $db) {
        $this->db = $db;
    }

    public function GetCoffeeTypes() {
        $stmt = $this->db->query("SELECT DISTINCT type FROM coffee");
		
        return $stmt->fetchAll();
    }

    public function GetCoffeeByType($type) {
        $stmt = $this->db->prepare("SELECT name, type, price, roast, country, image, review FROM coffee WHERE type LIKE :type");
        $stmt->execute(['%' . $type . '%']);
		
        return $stmt->fetchAll(PDO::FETCH_CLASS, 'CoffeeEntity');
    }

}
?>

Open in new window


<?php

class CoffeeEntity
{
    public $id;
    public $name;
    public $type;
    public $price;
    public $roast;
    public $country;
    public $image;
    public $review;
    
    function __construct($id, $name, $type, $price, $roast, $country, $image, $review) {
        $this->id = $id;
        $this->name = $name;
        $this->type = $type;
        $this->price = $price;
        $this->roast = $roast;
        $this->country = $country;
        $this->image = $image;
        $this->review = $review;
    }

}


?>

Open in new window

0
I am trying to pass in the value ASC to the database for a query but the error I get is:

Syntax error or access violation: 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 ''ASC''
Here is what I am sending via Ajax for testing:

var sort = 'ASC';
$.ajax({
        url: url + '/Admin/test',
        type: 'POST',
        dataType: 'json',
        data: {sort: sort}
    })

Open in new window


Controller:

    $data = [

        'sort' => $_POST['sort']
    ];

$reminders = $this->Model->Sort($data);

Open in new window


DB Query:

$this->db->query("SELECT fields
FROM tables
ORDER BY name :sort ");
$this->db->bind(":sort", $data['sort']);
$results = $this->db->resultSet();
return $results;

Open in new window

0
This is the query:
SELECT DATE(FROM_UNIXTIME(@unix_date_time:=substring_index(meta_value, '|',1))) AS "date" FROM wp_postmeta WHERE meta_key LIKE "etimeclockwp-away_%"

Open in new window


it  shows a table called date it currently show all dates
2019-11-14
2019-12-02
2019-12-16
2019-11-25
2020-01-08
I have been trying to sort date range using some stack overflow  example(


SELECT DATE(FROM_UNIXTIME(@unix_date_time:=substring_index(meta_value, '|',1))) AS "date" FROM wp_postmeta WHERE "date" >=`2019-11-14` AND "date" <=`2019-12-16` meta_key LIKE "etimeclockwp-away_%"

Open in new window


But it did not work.
What am I missing?

Goal = get any date range
0
Can you please help me in that error.
screenshot.JPGscreenshot2.JPGscreenshot3.JPG
<?php

require ("Entities/CoffeeEntity.php");

//Contains database related code for the Coffee page.
class CoffeeModel {

    //Get all coffee types from the database and return them in an array.
    function GetCoffeeTypes() {
        require 'Credentials.php';

        //Open connection and Select database.   
        mysql_connect($host, $user, $passwd) or die(mysql_error());
        mysql_select_db($database);
        $result = mysql_query("SELECT DISTINCT type FROM coffee") or die(mysql_error());
        $types = array();

        //Get data from database.
        while ($row = mysql_fetch_array($result)) {
            array_push($types, $row[0]);
        }

        //Close connection and return result.
        mysql_close();
        return $types;
    }

    //Get coffeeEntity objects from the database and return them in an array.
    function GetCoffeeByType($type) {
        require 'Credentials.php';

        //Open connection and Select database.     
        mysql_connect($host, $user, $passwd) or die(mysql_error);
        mysql_select_db($database);

        $query = "SELECT * FROM coffee WHERE type LIKE '$type'";
        $result = mysql_query($query) or die(mysql_error());
        $coffeeArray = array();

        //Get data from database.
        while ($row = mysql_fetch_array($result)) {
            $name = $row[1];
            $type = $row[2];
   

Open in new window

0
i'm on centos7 and i initially installed mariadb but it looks like socialengine might not be so good with that, to be safe I went and carefully removed mariadb and then installed mysql but having issues logging in

 mysqld --version
/usr/sbin/mysqld  Ver 8.0.18 for Linux on x86_64 (MySQL Community Server - GPL)

How do I login to mysql as root?

[root@dxpdemo mysql]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I'm pretty sure I have the right password

i tried numerous ways to get on..  I'm pretty confident I have the password correct.. I changed it after putting in the initial one

I already set the password beyond the regular and ran the secure installation but I'm not able to get into mysql

already tried this
https://stackoverflow.com/questions/33510184/change-mysql-root-password-on-centos7
0
Hello,

I am coding a custom Wordpress query, I want my keyword field to search post title, content and meta_queries..  The meta_query portion is working fine, but it isn't searching title and content. here is my code

$args = array (
    'post_type'			=>'resources',
    'post_status'       => 'publish',
	'posts_per_page'    => 100,
    'order'      => 'ASC',
    'search'     => '*' . esc_attr( $this_key ) . '*',
    'meta_query' => 
	
           array(
			'relation' => 'OR',
				array(
					'key'     => 'feedback',
					'value'   => $this_key,
					'compare' => 'LIKE'
				),
			array(
				'key'     => 'bfi_steps',
				'value'   => $this_key,
				'compare' => 'LIKE'
			),
			array(
				'key'     => 'agency',
				'value'   => $this_key ,
				'compare' => 'LIKE'
   				 )
		
		
	)

);

Open in new window

0
Can you please tell me how to i fix that error?  Thanks.

SOMETHING IS WRONG HERE: function mysqli_fetch_all($result, MYSQLI_ASSOC)
Warning: mysqli_connect(): (28000/1045): Access denied for user 'HarrisK'@'ip-107-180-46-230.ip.secureserver.net' (using password: YES) in /home/hfll4ovlkhjz/public_html/config/db_connect.php on line 3
Connection error: Access denied for user 'HarrisK'@'ip-107-180-46-230.ip.secureserver.net' (using password: YES)
Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/hfll4ovlkhjz/public_html/index.php on line 6

Fatal error: Uncaught Error: Call to undefined function mysqli_fetch_all() in /home/hfll4ovlkhjz/public_html/index.php:8 Stack trace: #0 {main} thrown in /home/hfll4ovlkhjz/public_html/index.php on line 8

Open in new window


<?php
	include('config/db_connect.php');
	// write query for all pizzas
	$sql = 'SELECT title, ingredients, id FROM pizzas ORDER BY created_at';
	// get the result set (set of rows)
	$result = mysqli_query($conn, $sql);
	// fetch the resulting rows as an array
	$pizzas = mysqli_fetch_all($result, MYSQLI_ASSOC);
	// free the $result from memory (good practise)
	mysqli_free_result($result);
	// close connection
	mysqli_close($conn);
?>

<!DOCTYPE html>
<html>
	
	<?php include('templates/header.php'); ?>

	<h4 class="center grey-text">Pizzas!</h4>

	<div class="container">
		<div class="row">

			<?php foreach($pizzas as $pizza): ?>

				<div class="col s6 m4">
					<div class="card z-depth-0">
						<img src="img/pizza.svg"class="pizza">
						<div class="card-content center">
							<h6><?php echo htmlspecialchars($pizza['title']); ?></h6>
							<ul class="grey-text">
								<?php foreach(explode(',', $pizza['ingredients']) as $ing): ?>
									<li><?php echo htmlspecialchars($ing); ?></li>
								<?php endforeach; ?>
							</ul>
						</div>
						<div class="card-action right-align">
							<a class="brand-text" href="details.php?id=<?php echo $pizza['id'] ?>">more info</a>
						</div>
					</div>
				</div>

			<?php endforeach; ?>

		</div>
	</div>

	<?php include('templates/footer.php'); ?>

</html>

Open in new window

0
Can you please tell me why its not showing a create button next to databases?  Thanks.
screenshot.JPG
0
Can you please help me in that error?  Thanks
Error: MySQL shutdown unexpectedly.

XAMPP MySQL Error
InnoDB: using atomic writes.
2020-01-11 16:01:51 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2020-01-11 16:01:51 0 [Note] InnoDB: Uses event mutexes
2020-01-11 16:01:51 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-01-11 16:01:51 0 [Note] InnoDB: Number of pools: 1
2020-01-11 16:01:51 0 [Note] InnoDB: Using SSE2 crc32 instructions
2020-01-11 16:01:51 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2020-01-11 16:01:51 0 [Note] InnoDB: Completed initialization of buffer pool
2020-01-11 16:01:51 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=300288
2020-01-11 16:01:59 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-01-11 16:01:59 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-01-11 16:01:59 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-01-11 16:01:59 0 [Note] InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-01-11 16:01:59 0 [Note] InnoDB: File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB.
2020-01-11 16:01:59 0 [Note] InnoDB: Waiting for purge to start
2020-01-11 16:01:59 0 [Note] InnoDB: 10.4.11 started; log sequence number 300297; transaction id 171
2020-01-11 16:01:59 0 [Note] InnoDB: Loading buffer pool(s) from 

Open in new window

0
How to i execute my php index file in wamp?  Thanks.
screenshot.JPGscreenshot2.JPGscreenshot3.JPG
0
Hello,

I have to Left join to the same 2 tabs twice, I know you are supposed to us an alias AS, but I can't get the syntax correct.

Here is my base query:
I am joining the the artist table and client table from both the tps_tour and invoice_project tables.

SELECT * FROM daily_deposit 

LEFT JOIN deposit_venue ON daily_deposit.daily_deposit_id = deposit_venue.deposit_venue_deposit 
LEFT JOIN show_settlement ON deposit_venue.deposit_venue_settlements = show_settlement.show_settlement_id 
LEFT JOIN tps_shows ON show_settlement.show_settlement_show = tps_shows.tps_shows_id 

LEFT JOIN tps_tour ON tps_shows.tps_shows_tps = tps_tour.tps_tour_id 
	LEFT JOIN artist ON tps_tour.tps_tour_artist = artist.artist_id 
	LEFT JOIN client ON tps_tour.tps_tour_client = client.client_id 

 
LEFT JOIN invoice_project ON deposit_invoice.deposit_invoice_invoice = invoice_project.invoice_project_id  
	LEFT JOIN artist ON invoice_project.invoice_project_artist = artist.artist_id 
	LEFT JOIN client ON invoice_project.invoice_project_client = client.client_id 


 $criteria  GROUP BY daily_deposit_id  ORDER BY $final_sort  LIMIT $startnumber, $number_per_pag

Open in new window

0
Note:The table itsels is irrelavent to the question and as such it's not posted. (becuase the query is correct).

My question is :
Is there an SQL way to filter (such as regex) only select (not to update the table just display when queried)
out everything after the pipeline.



1) I only want to display/query not update the query results/
Here is the query result (which is working fine and the output is what should be outputed)   the "pipe " /  "|" delimiter is not another column
I will repeat again so it's not confusing
the "pipe " /  "|" delimiter is not another column it's one string.

3)The query

SELECT meta_value FROM wp_postmeta WHERE meta_key LIKE 'etimeclockwp-in%'

2)  the output (this is one column).
1576486935|8
1576141273|21
1574067745|23

3) Sample output after the questioned query  :
1576486935
1576141273
1574067745

Thank You.
0
Hi all i am having some massive brain farts at the moment and i cant work out the issue i am having, i have been starting at the code for hours and i know its on a small issue, i am getting a error on line 58, i know its got to do with formatting but for the life of me i ant get it to work correctly
#****
# *****
# VERSION 1.0
# DATE 6 Jan 2020
# UPDATED 6 Jan 2020
# *****


import mysql.connector
import pandas as pd
import mysql.connector
import urllib.parse
import requests
import finddatatime  # Getting the date from the second script called finddatetime.py

currentdatetime = finddatatime.date_time

print ("The Current time date is" + " " + currentdatetime)

from mysql.connector import Error
from __main__ import *

mydb = mysql.connector.connect(
    host="localhost",
    user="root",
    passwd="A*****1",
    database="flightdata"
)

mycursor = mydb.cursor()

fnumber = (input("Please enter flight number:  "))

sql = 'SELECT * FROM flightdata.flightinfo where flightnumbers =' + "'" + fnumber + "'"
# print(sql)

mycursor.execute(sql)
# connection.commit()

myresult = mycursor.fetchall()

for x in myresult:
    flightnumber = x[3]
    orgin = x[10]
    dest = x[2]
    departtime = x[4]
    status = x[8]

answer = (input("Flight #: " + str(flightnumber) + " From: " + str(orgin) + " To: " + str(dest) + " At: " + str(
    departtime) + "is that correct? yes/no: "))
# if statment for answer start
if answer == "yes":
    print("Current status of your flight as of " + 

Open in new window

0
Dear Experts
Would like to create power BI user account into MySQL transnational DB (CRM application -based on LAMP stack) but we would like to apply security permissions of the PowerBI account to have ‘Read-Only’ to the database and all it is tables.
The objective is the MySQL user which being used as power BI connector account to have only “Read-Only” privileges therefore no write/update/modifications/delete is possible from PowerBI to the Database of CRM applicaiton, please suggest the privileges that to be set for the database for the power BI user account.
 The mysql user name is sqlconuser and database name production, please help with the command in the mysql prompt command line in linux system on how to set privileges read only  for the database name "production " for the MySQL user sqlconuser think should also provide access to access to all Tables, Views and Triggers, please provide compete command that to be executed, thanks in advance.
0
I have a PHP class that I created for my database connection and queries. Im having an issue with the mysqli_insert_id, I know the reason for this is because after my query function, I close the connection therefore when I call the last_insert_id function it returns 0, can someone guide me on how i can fix this issue.

    public function get_connection(){
        try{
            $this->connection = @mysqli_connect( $this->databaselink, $this->username, $this->password );
            if( $this->connection === false ){           
                throw new Exception( mysql_error() );
            }           
            if( !mysqli_select_db($this->connection, $this->database) ){
                echo "no db selected error";
                throw new Exception( mysql_error() );
            }
        }
        catch(Exception $e){
            echo $e->getMessage();
            //$this->log->logger( "MYSQL", $e, $query );
        }
    }
 
    public function close_connection(){
        mysqli_close( $this->connection );
        $this->connection = NULL;
    }
   
    public function query( $query ){
        $this->get_connection();
       
        try {
            if( empty($query) ){
                
				throw new Exception($query . " query empty");
            }
           
            $this->result = @mysqli_query($this->connection, $query);
            if( !$this->result ){
                throw new Exception( mysqli_error($this->connection) );
            } else {

Open in new window

0
Hi,
How to resolve version below, as I did copy the file from the path below?

C:\Program Files\MySQL\MySQL Server 5.7\lib

0a.png
0
Hi,
Can I have details to enable relevant port below, due to error in MySQL DB?
5b.png
0
hi all i have almost got my deployment server ready work but anytime i try to so anything on mysql wordbench from remote i am getting a error
Executing:
CREATE SCHEMA `flightdata` ;

Operation failed: There was an error while applying the SQL script to the database.
ERROR 1044: Access denied for user 'root'@'%' to database 'flightdata'
SQL Statement:
CREATE SCHEMA `flightdata`




can someone please help
0
Hi all i am like 99% finshed this pain in the but script but i am now getting a error mysql.connector.errors.ProgrammingError: 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

for the life of me i cant work it out and i tihnk i am going half blind just looking at the code can you please help me out

from requests_html import HTMLSession
import mysql.connector



mydb = mysql.connector.connect(
  host="localhost",
  user="root",
  passwd="*****",
  database="flightdata"
)




mycursor = mydb.cursor()

# create an HTML Session object
session = HTMLSession()

# Use the object above to connect to needed webpage
resp = session.get("https://www.adelaideairport.com.au/flight-information/flight-search/?flt_no=&carrier=All&city=&dte=Current&leg=Departures")

# Run JavaScript code on webpage
resp.html.render()
data = []

airline_spans = resp.html.find('.SearchResultFlightListRow')
print (airline_spans)
airline_list = [span.text.split('\n') for span in airline_spans]

for flight in airline_list:
    if len(flight) == 7:
        flightno, From, to, scheduled, estimated, gate, status = flight
        print ("This is a " + estimated)
        if estimated == "":
            print (" currently no dely ")
            print ("This is a " + estimated)
            estimated = 'IDEL'
    #    print (f'Flight no {flightno} from  {From} to {to} is scheduled to depart at {scheduled} from 

Open in new window

0
from requests_html import HTMLSession
import mysql.connector

mydb = mysql.connector.connect(
  host="localhost",
  user="root",
  passwd="**",
  database="flightdata"
)

mycursor = mydb.cursor()

# create an HTML Session object
session = HTMLSession()

# Use the object above to connect to needed webpage
resp = session.get("https://www.adelaideairport.com.au/flight-information/flight-search/?flt_no=&carrier=All&city=&dte=Current&leg=Departures")

# Run JavaScript code on webpage
resp.html.render()


airline_spans = resp.html.find('.SearchResultFlightListRow')
print (airline_spans)
airline_list = [span.text.split('\n') for span in airline_spans]

for flight in airline_list:
    if len(flight) == 7:
        flightno, From, to, scheduled, estimated, gate, status = flight
        print ("This is a " + estimated)
        if estimated == "":
            print (" currently no dely ")
            print ("This is a " + estimated)
            estimated = 'IDEL'
        print (f'Flight no {flightno} from  {From} to {to} is scheduled to depart at {scheduled} from gate {gate} and flight status is {status}')

    elif len(flight) == 6:
        flightno, From, to, scheduled, estimated, gate = flight
        status = 'IDEL'
        print ("This is a " + estimated)
        if estimated == "":
            print (" currently no dely ")
            print ("This is a " + estimated)
            estimated = 'IDEL'
        print (f'Flight no {flightno} …
0
I want to install MySQL database server on RHEL 5.7 Virtual machine.

I want to test exporting large oracle tables from oracle DBMS server 12.2 into MySQL tables.

1) How long does it take to download, install and configure the server?

2) Do I need to download the free community server or enterprise server for the export oracle data test?

3) Which site do you normally use to download software?

Thanks,
0
Hi,
Sorry to that I had zip file only (for mysql-5.7.28-win32-debug-test), and do you have executable setup file for the same version?
0
hi,

I am not that zero knowledge on oracle as I have attend Oracle 11g workshop,  and also have more and more knowledge of Oracle like topology and theory as well as weakness of Oracle. I DO NOT have hands on setting up RAC, dataguard, ASM and replication on  Oracle,.

Now I want to get Oracle OCP, for example, for 19c, any kind of resource/URL/video/book you oracle expertise can suggest me to read to pass OCP as easy as possible ?

12c, 18c and 19c is the version of focus.

I prefer online video training, as it is easier for me.

how about the same thing for MySQL ? I want to get OCP for MySQL too and I have a lot of hands on experience on MySQL , like replication, InnodB cluster , but NOT NDB cluster yet!
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.