Is it possible to create a new database with Mysql username and password directly from the PHP script? I ask why we are finalizing a registration system where each client will have its own database. If so, could you provide an example? I understand that to create a database, I can use:
mysqli_query($conexaoPrimaria,"CREATE DATABASE ".$banco." ");
But the user (with all permissions) and password?
=====================
ANSWER
I was able to resolve it as follows:
mysqli_query($conexao,"CREATE USER 'novo_usuario'@'localhost' IDENTIFIED WITH mysql_native_password AS 'senha_usuario'");
mysqli_query($conexao,"GRANT ALL PRIVILEGES ON *.* TO 'novo_usuario'@'localhost' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;");
mysqli_query($conexao,"GRANT ALL PRIVILEGES ON 'novo_usuario'.* TO 'novo_usuario'@'localhost';");
mysqli_query($conexao,"GRANT ALL PRIVILEGES ON 'novo_usuario\_localhost'.* TO 'novo_usuario'@'localhost';");
======================