Important MariaDB Update to 10.3

Discussion in 'Free Hosting' started by garrettroyce, Jan 5, 2021.

Thread Status:
Not open for further replies.
  1. garrettroyce

    garrettroyce Community Support Community Support

    Messages:
    5,601
    Likes Received:
    239
    Trophy Points:
    63
    Good news, everyone! I worked with our head admin today and I was able to get MariaDB (MySQL equivalent software) updated to the 10.3 version, up from 10.1. I have tagged the users requesting this feature below.

    You should not notice any changes.

    However, if you notice MySQL errors on your website or in your error log, please let us know.

    @mathsmoo
    @bcarc
     
    • Like Like x 1
  2. sistcon2

    sistcon2 New Member

    Messages:
    3
    Likes Received:
    2
    Trophy Points:
    1
    Hola... necesito desactivar STRICT_TRANS_TABLES y con la actualización no me lo permite por falta de privilegios en el user que se crea de manera aleatoria cada vez que entro a phpMyAdmin... ayuda
     
  3. garrettroyce

    garrettroyce Community Support Community Support

    Messages:
    5,601
    Likes Received:
    239
    Trophy Points:
    63
    Lo siento, el soporte solo se ofrece en inglés. Sin embargo, estoy enlazando la traducción al español porque su pregunta es muy importante.

    Si algún usuario tiene un problema con las consultas SQL que anteriormente funcionaban, es debido a un cambio en la forma en que MariaDB (y MySQL también) han cambiado el manejo de errores. Anteriormente, algunos errores se ignoraban silenciosamente, aunque la consulta tenía un formato incorrecto. A partir de la versión 10.2.4 de MariaDB (ahora estamos en 10.3), ya no permite estas consultas con formato incorrecto. Esto no se puede cambiar para usuarios individuales. Para forzar una consulta con formato incorrecto, puede anular esta configuración por sesión.

    Si está utilizando un software PHP que tiene este problema, puede insertar esta consulta directamente después de que se establezca la conexión con el servidor. Aquí hay un ejemplo con mysqli:
    PHP:
    $mysqli = new mysqli(/ * sus datos de conexión aquí * /); // esto ya existe
    $mysqli->query("SET sql_mode = 'NO_ENGINE_SUBSTITUTION, NO_AUTO_CREATE_USER';"); // agrega esta línea

    Usando PDO:
    PHP:
    $pdo = new PDO(/ * sus datos de conexión aquí * /); // esto ya existe
    $pdo->query("SET sql_mode = 'NO_ENGINE_SUBSTITUTION, NO_AUTO_CREATE_USER';"); // agrega esta línea

    Usando mysql (extensión original):
    PHP:
    /* no use la extensión mysql original */

    Consulte con su desarrollador de software cómo aplicar esto si no está seguro, o puede preguntar en el foro aquí.

    I'm sorry, support is only offered in english. I'm linking the spanish translation for you, though, because your question is very important.

    If any users are having a problem with SQL queries that were previously working, it is because of a change in the way that MariaDB (and MySQL, too) have changed error handling. Previously, some errors were silently ignored, even though the query was malformed. As of MariaDB version 10.2.4 (we're now on 10.3), it no longer allows these malformed queries at all. This cannot be changed for individual users. To force a malformed query, you can override this setting per session.

    If you are using PHP software that is having this problem, you can insert this query directly after the connection to the server is established. Here is an example with mysqli:
    PHP:
    $mysqli = new mysqli(/* your connection details here */); // this already exists
    $mysqli->query("SET sql_mode = 'NO_ENGINE_SUBSTITUTION, NO_AUTO_CREATE_USER';"); // add this line

    Using PDO:
    PHP:
    $pdo = new PDO(/* your connection details here */); // this already exists
    $pdo->query("SET sql_mode = 'NO_ENGINE_SUBSTITUTION, NO_AUTO_CREATE_USER';"); // add this line

    Using mysql (original extension):
    PHP:
    /* do not use the original mysql extension */

    Please check with your software developer on how to apply this if you are unsure, or you can ask in the forum here.
     
  4. sistcon2

    sistcon2 New Member

    Messages:
    3
    Likes Received:
    2
    Trophy Points:
    1
    Muy agradecido con usted por haberme respondido pronto... su respuesta me ayudó a resolver el problema... saludos y gracias por su atención

    :)
     
    • Like Like x 1
  5. sistcon2

    sistcon2 New Member

    Messages:
    3
    Likes Received:
    2
    Trophy Points:
    1
     
    • Like Like x 1
  6. mucmark2

    mucmark2 New Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    After this update my site can no longer INSERT into my db. Nothing else has changed and the site has worked for the past two years. I checked the permissions for the db user, I'm getting no errors or notices related to this issue with error_reporting set to E_ALL, and I tried upgrading to php 7.3.

    I added:
    PHP:
    $conn = new mysqli($servername$username$password);
    $conn->query("SET sql_mode = 'NO_ENGINE_SUBSTITUTION, NO_AUTO_CREATE_USER';");
    and it still does not work. This is the broken statement:
    PHP:
    public function insertFormSubmission()
    {
        
    // Insert the user's input on the form into the `Data` column
        
    $conn $this->connection;
        
    $stmt $conn->prepare("INSERT INTO `orders` (`Owner`, `Data`) VALUES (?, ?)");
        
    $stmt->bind_param("ss"$this->formAccount$serialOrderArray);

        foreach (
    $this->formConfig[$this->formAccount] as $keyInput=>$valueInput)
        {
            if (isset(
    $_POST$valueInput['name'] ]))
            {
                
    $serialOrderArray$valueInput['name'] ] = $_POST$valueInput['name'] ];
            }
            else
            {
                
    $serialOrderArray$valueInput['name'] ] = "";
            }
        }

        
    $serialOrderArray serialize($serialOrderArray);
        
    $stmt->execute();
    }
     
    Last edited: Jan 11, 2021
  7. garrettroyce

    garrettroyce Community Support Community Support

    Messages:
    5,601
    Likes Received:
    239
    Trophy Points:
    63
    You should check the return value of $stmt->execute() (false for error, true for success) and also $conn->error_list for more details.

    You're using prepared statements, which would stop injection attacks, but you might want to consider using some input checking to stop someone from sending huge amounts of data, control characters, etc.
     
  8. mathsmoo

    mathsmoo New Member

    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Thank you very much.
     
Thread Status:
Not open for further replies.

Share This Page