Accessing a MySQL database through a Perl scriptTo access your MySQL database from your Perl scripts, you can provide the following database server name in your connection string: localhost For MySQL 8, the database server name is the same, but you will need to set the connection port to 3308. Here are example connection strings for MySQL 5: DBI->connect('DBI:mysql:localhost:database=mysql_database', 'mysql_user', 'mysql_password') or die "Database connection failed"; and MySQL 8: DBI->connect('DBI:mysql:localhost:database=mysql_database;port=3308', 'mysql_user', 'mysql_password') or die "Database connection failed"; You can find the correct database server settings for MySQL 8 for some of the most popular software applications in our MySQL 8 database server settings article. |