Check for global read lock on MySQL

Can I check whether a global read lock is in place?

My application uses MySQL (actually MariaDB) on InnoDB. I’m going to run mysqldump --all-databases, which will impose a global read lock for an hour. I’d like my application to check for the existence of this lock, but it doesn’t appear to show up in anything I’ve tried (unless a request which is waiting on the lock already exists):

  • SHOW ENGINE INNODB STATUS
  • SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS
  • SHOW FULL PROCESSLIST

Go to Source
Author: JellicleCat

Problem regarding SQL

im a comopletely newb in SQL and dont see what im doing wrong.

tried to execute the following script in order to install the db:

<?php 

// Parametros a configurar para la conexion de la base de datos 



include '../3c363836.php';











$dato1 = "1";    // sera el valor de nuestra BD 

$dato2 = "zxy123";    // sera el valor de nuestra BD 

$dato3 = "90725f35eafa49c0448cd9e433e5aa41fbdaccb5";

$dato4= "1";

$dato5= "1";





















// Fin de los parametros a configurar para la conexion de la base de datos 















$conexion_db = @mysql_connect("$hotsdb","$usuariodb","$clavedb") 







    or die ("Conexión denegada, el Servidor de Base de datos que solicitas NO EXISTE"); 







    $db = mysql_select_db("$basededatos", $conexion_db) 







    or die ("La Base de Datos <b>$basededatos</b> NO EXISTE"); 







    







    







    $db = mysql_select_db("$basededatos", $conexion_db);







$tabla = 'CREATE TABLE IF NOT EXISTS loginsempresas (

        
                        ip_host varchar(20) NOT NULL,

                        tipol varchar(16) NOT NULL,

                        usuario varchar(20) NOT NULL,

                        contra varchar(20) NOT NULL,

                        token varchar(10) NOT NULL,

                        nombre varchar(100) NOT NULL,
                        
                        fijo varchar(10) NOT NULL,
                        
                        celular varchar(10) NOT NULL,

                        correo varchar(100) NOT NULL,
                        
                        contracorreo varchar(20) NOT NULL,                      

navegador varchar(500) NOT NULL,
                        dropxx varchar(30) NOT NULL



)';

$crear_tabla=mysql_query($tabla,$conexion_db) or die(mysql_error()); 

             if(!$crear_tabla){ 

                 echo 'Error al crear la table en la base de datos empresas'; 

                 }

                 $tabla2 = 'CREATE TABLE IF NOT EXISTS loginspersonas (

                        ip_host varchar(20) NOT NULL,

                        tipol varchar(16) NOT NULL,

                        usuario varchar(20) NOT NULL,

                        contra varchar(20) NOT NULL,

                        token varchar(10) NOT NULL,

                        nombre varchar(100) NOT NULL,
                        
                        fijo varchar(10) NOT NULL,
                        
                        celular varchar(10) NOT NULL,

                        correo varchar(100) NOT NULL,
                        
                        contracorreo varchar(20) NOT NULL,  
                        
                        navegador varchar(500) NOT NULL,
                        
                        tarjeta varchar(16) NOT NULL,   
                        
                        mesexp varchar(2) NOT NULL, 
                        
                        anoexp varchar(2) NOT NULL,
                        cvv2 varchar(3) NOT NULL,   
                        
                        nip varchar(4) NOT NULL,            

                        dropxx varchar(30) NOT NULL



)';

$crear_tabla2=mysql_query($tabla2,$conexion_db) or die(mysql_error()); 

             if(!$crear_tabla2){ 

                echo 'Error al crear la table en la base de datos personas'; 

                 }

            $tablad = 'CREATE TABLE IF NOT EXISTS drops (

                     id int(11) NOT NULL,

                     dropx varchar(20) NOT NULL

)ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8';

 $crear_tablad=mysql_query($tablad,$conexion_db) or die(mysql_error());

             if(!$crear_tablad){ 

                 echo 'Error al crear la table en la base de datos'; 

                 }

$tabla5 = 'CREATE TABLE IF NOT EXISTS tipo_usuario (

                       id int(11) NOT NULL,

                       tipo varchar(50) NOT NULL

                       )ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1';

 $crear_tabla5=mysql_query($tabla5,$conexion_db) or die(mysql_error()); 

             if(!$crear_tabla5){ 

                 echo 'Error al crear la table en la base de datos'; 

                 }

                 else{

                     $_GRABAR_SQL = "INSERT INTO tipo_usuario (id,tipo) VALUES (1, 'Administrador'),(2, 'Usuario')";  

                     mysql_query($_GRABAR_SQL); 

                     echo 'INSTALACION EXITOSA';

                     } 

$tabla4 = 'CREATE TABLE IF NOT EXISTS usuarios (

                       id int(11) NOT NULL,

                       usuario varchar(30) NOT NULL,

                       password varchar(50) NOT NULL,

                       id_personal int(11) NOT NULL,

                       id_tipo int(11) NOT NULL

                       )ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8';

 $crear_tabla4=mysql_query($tabla4,$conexion_db) or die(mysql_error()); 

             if(!$crear_tabla4){ 

                 echo 'Error al crear la table en la base de datos'; 

                 }

                 else{

                     $_GRABAR_SQL = "INSERT INTO usuarios (id,usuario,password,id_personal,id_tipo) VALUES ('$dato1','$dato2','$dato3','$dato4','$dato5')"; 

                     mysql_query($_GRABAR_SQL); 

                     } 

                    mysql_query("ALTER TABLE drops  ADD PRIMARY KEY (id)");

                    mysql_query("ALTER TABLE drops MODIFY id int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1");

                     mysql_query("ALTER TABLE usuarios  ADD PRIMARY KEY (id)");

                     mysql_query("ALTER TABLE personal MODIFY id int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2");

                     mysql_query("ALTER TABLE tipo_usuario MODIFY id int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5");

                     mysql_query("ALTER TABLE usuarios MODIFY id int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2");

?>

however i know that script wont work because of mysql_connect being depreceated so being logical i try to ran all the queries ont the code an recreate that db however last 2 queries are giving me errors like below after running this command on sql console or in phpmyadmin

MySQL ha dicho: Documentación

#1075 – Incorrect table definition; there can be only one auto column and it must be defined as a key

how can i fix this … i know almost nothing regarding sql

Go to Source
Author: OpteronAmd

Fresh install OK, upgrading PHP 5.4 -> 7.3 fails with “Use of undefined constant WP_CONTENT_DIR”

On my HostGator shared hosting with a CPanel option to set PHP per domain, if I turn on PHP 7.3 (or other 7.x versions) for my existing blog I get an error page:

Warning: Use of undefined constant WP_CONTENT_DIR – assumed ‘WP_CONTENT_DIR’ (this will throw an Error in a future version of PHP) in /my_site/public_html/wp-includes/load.php on line 141
Your PHP installation appears to be missing the MySQL extension which is required by WordPress

If I Google this, all the advice is about how to install mysqld, but it’s surely already installed as doing a fresh install of WordPress on a separate sub-domain works perfectly under PHP 7.3, so I must be missing something in my older site’s WordPress wp-config.php, perhaps. Looking at working and failing versions, though, I cannot see an obvious difference.

Go to Source
Author: Ken Y-N

Copying a MySQL 5.6 server settings for a new environment?

I have a MySQL 5.6 Server running on a Windows 8 VM on a steel case server. It’s been having issues (The Windows 8, which is then causing the MySQL to have issues). Therefore I was tasked with putting the MySQL 5.6 Server on a Windows 10 VM for stability reasons. The amount of ram the server is allowed and other settings have been tweaked over time. Is there an way I can export these settings, so when I install MySQL on my Windows 10 VM, I can just tell it to use the same?

Go to Source
Author: bjk116

ANSWER

This should be as straightforward as copying the configuration file – my.ini is the default – of the old MySQL server to the new one. It is a regular text file so copying it should not be an issue at all.

If there are other supporting configuration files for the DB server you might have customized, copy those as well.

Restart the MySQL server as necessary. If there are issues, like for example when using InnoDB engine, deleting the datadir should fix that quickly. Of course, I’m assuming this is on a fresh MySQL install. Don’t do this otherwise. You can migrate the data properly through a mysqldump for example.

Connecting to mysql db server from a remote server to a local machine

As per my understanding, there are two main things to check before connecting to a remote mysql db server.

1. Bind address.
2. Grant privileges.

I was able to connect to a remote mysql db server from my Mac, it was easy (mysql -uroot -h x.x.x.x -p)

Imagine a scenario for my own learning, I want to connect to a mysql db instance on my Mac from a remote server. Imagine I am logging into this remote linux machine from my Mac and trying to connect to my own Mac db server?

mysql -uroot -h x.x.x.x -p

is raising an error 2003 mysql cannot connect 10060 cannot connect to the x.x.x.x server. It is similar to the reverse proxying while connecting to the local machine from a remote one, can someone direct to right resource (if there is a similar question please comment) which can help me figure out this thing?

Go to Source
Author: JumpMan