i’m trying to make an installer that will setup mysql databases for the application, for example, install.php where when run, the script creates a database and runs scripts to create the tables and required records.
but so far, i only know how to connect to mysql in php by using something like:
$db = new mysqli(‘localhost’, ‘username’, ‘password’, ‘dbname’ );
however, in this format, the database name has to be included.
how is this done?
i’m also okay with a mysql command that uploads a .sql script from command line. though i only know using:
mysql -uuser -ppassword dbnam < source_file.txt
which means the database also has to be created.
thanks.