{"id":32,"date":"2008-03-23T17:14:39","date_gmt":"2008-03-24T01:14:39","guid":{"rendered":"http:\/\/staging.www.zenutech.com\/kb\/databases\/connecting-to-mysql-with-perl\/"},"modified":"2024-04-10T09:40:54","modified_gmt":"2024-04-10T14:40:54","slug":"connecting-to-mysql-with-perl","status":"publish","type":"post","link":"https:\/\/www.zenutech.com\/kb\/article\/connecting-to-mysql-with-perl\/","title":{"rendered":"Connecting to MySQL with Perl"},"content":{"rendered":"<p>Please consult the perl documentation located at <a href=\"https:\/\/perldoc.perl.org\/\" target=\"_new\">https:\/\/perldoc.perl.org\/<\/a>.<\/p>\n<p>The following example connects to the database &#8220;your_database_name&#8221; with the username &#8220;your_mysql_user&#8221; and password &#8220;your_password&#8221;. You will need to substitute these values for your actual database, username, and password you have set up in your hosting control panel (cPanel).  If you have not already prepared a MySQL user and database in cPanel, please see the following <a href=\"\/kb\/article\/how-do-i-prepare-a-database-for-my-website\/\" target=\"_blank\">instructions<\/a>.<\/p>\n<pre>\r\n$mysql_server = \"localhost\";\r\n$mysql_db = \"your_database_name\";\r\n$mysql_user = \"your_mysql_user\";\r\n$mysql_password = \"your_password\";\r\n$dbh = DBI-&gt;connect(\"DBI:mysql:database=$mysql_db;host=$mysql_server\", $mysql_user, $mysql_password, {'RaiseError' =&gt; 1});<\/blockquote>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>An example of connecting to MySQL with Perl.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,10],"tags":[292,48,58,294],"class_list":["post-32","post","type-post","status-publish","format-standard","hentry","category-databases","category-web-development","tag-databases","tag-mysql","tag-perl","tag-web-development"],"_links":{"self":[{"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/comments?post=32"}],"version-history":[{"count":4,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":705,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/posts\/32\/revisions\/705"}],"wp:attachment":[{"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}