{"id":1104,"date":"2018-07-21T17:55:14","date_gmt":"2018-07-21T15:55:14","guid":{"rendered":"https:\/\/assistance.groupemagiconline.com\/?post_type=ht_kb&#038;p=1104"},"modified":"2020-02-11T15:52:27","modified_gmt":"2020-02-11T14:52:27","slug":"plesk-se-connecter-a-ma-base-de-donnees-mysql","status":"publish","type":"ht_kb","link":"https:\/\/assistance.groupemagiconline.com\/en\/knowledge-base\/plesk-se-connecter-a-ma-base-de-donnees-mysql\/","title":{"rendered":"Plesk: Connect to my MySQL database"},"content":{"rendered":"<p style=\"text-align: justify;\">In this guide, we will see how to connect to a database <a href=\"https:\/\/assistance.groupemagiconline.com\/en\/knowledge-base\/plesk-acceder-a-ma-base-de-donnees-mysql\/\">MySQL<\/a> created on a Plesk server.<\/p>\n<h3 style=\"text-align: justify;\">MySQL database connection parameters<\/h3>\n<p style=\"text-align: justify;\">First of all, you should know that you need four parameters to connect to the MySQL database;<\/p>\n<ul style=\"text-align: justify;\">\n<li>The host name (or server) that hosts the database.<\/li>\n<li>The name of the database.<\/li>\n<li>The user name of the database.<\/li>\n<li>The password of the database user.<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">If you have not yet created your MySQL database in Plesk, please follow this\u00a0<a href=\"#\">help link<\/a>.<\/p>\n<p style=\"text-align: justify;\">For shared servers, it is not possible to connect to the MySQL database from <a href=\"https:\/\/www.magic.fr\/serveurs\/\">a server<\/a> <strong>external<\/strong>. The connection can only be established on the shared hosting server.<\/p>\n<p style=\"text-align: justify;\">Basically, only the scripts of your website hosted on the same database server can access the database, insert, delete and modify data.<\/p>\n<h3 style=\"text-align: justify;\">Connecting to a MySQL database from WordPress<\/h3>\n<p style=\"text-align: justify;\">The MySQL database connection chain is very simple. Here is an example of the configuration file\u00a0<strong>wp-config.php<\/strong>\u00a0from\u00a0<strong>WordPress<\/strong>\u00a0which allows access to the database:<br \/>\n\/** The name of the database for WordPress *\/<br \/>\ndefine('DB_NAME', '<strong>ma-base<\/strong>');<\/p>\n<p style=\"text-align: justify;\">\/** MySQL database username *\/<br \/>\ndefine('DB_USER', '<strong>my-user<\/strong>');<\/p>\n<p style=\"text-align: justify;\">\/** MySQL database password *\/<br \/>\ndefine('DB_PASSWORD', '<strong>uNrd41!7<\/strong>');<\/p>\n<p style=\"text-align: justify;\">\/** MySQL hostname *\/<br \/>\ndefine('DB_HOST', '<strong>localhost<\/strong>:3306\u2032);<\/p>\n<p style=\"text-align: justify;\">Any other script must have the same connection parameters for the connection to the database to be established properly.<\/p>","protected":false},"excerpt":{"rendered":"<p>In this guide we will see how to connect to a MySQL database created on a Plesk server. MySQL database connection parameters First of all, you should know that you need four parameters to connect to the MySQL database; The host name (or server) that hosts the MySQL database, the name of the...<\/p>","protected":false},"author":52,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[728],"ht-kb-tag":[],"class_list":["post-1104","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-serveur-plesk"],"_links":{"self":[{"href":"https:\/\/assistance.groupemagiconline.com\/en\/wp-json\/wp\/v2\/ht-kb\/1104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assistance.groupemagiconline.com\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/assistance.groupemagiconline.com\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/assistance.groupemagiconline.com\/en\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/assistance.groupemagiconline.com\/en\/wp-json\/wp\/v2\/comments?post=1104"}],"version-history":[{"count":0,"href":"https:\/\/assistance.groupemagiconline.com\/en\/wp-json\/wp\/v2\/ht-kb\/1104\/revisions"}],"wp:attachment":[{"href":"https:\/\/assistance.groupemagiconline.com\/en\/wp-json\/wp\/v2\/media?parent=1104"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/assistance.groupemagiconline.com\/en\/wp-json\/wp\/v2\/ht-kb-category?post=1104"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/assistance.groupemagiconline.com\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=1104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}