{"id":5489,"date":"2018-08-22T05:36:45","date_gmt":"2018-08-22T05:36:45","guid":{"rendered":"https:\/\/www.truehost.co.ke\/support\/?post_type=ht_kb&#038;p=5489"},"modified":"2024-06-07T13:03:36","modified_gmt":"2024-06-07T13:03:36","password":"","slug":"connection-settings-mysql-databases","status":"publish","type":"docs","link":"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/","title":{"rendered":"Connection settings for MySQL databases"},"content":{"rendered":"<p>To connect to MySQL database, you neeed the following pieces of information.<\/p>\n<p>1. Hostname<\/p>\n<p>Use localhost as hostname at all time. If localhost does not work, use 127.0.0.1<\/p>\n<p>2. Username<\/p>\n<p>This is the user who has privileges to access the database and make changes to it. In cpanel, this user is normally created to include the cpanel username as well. Eg if your cPanel username is <b>example<\/b>, then the database user will be something like <b>example_dbuser.<\/b> Here\u2019s how you create a database user:<\/p>\n<p>a) Access cpanel and scroll to <b>M<\/b><b>y<\/b><b>SQL Databases<\/b>. Click it<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5490\" src=\"https:\/\/www.truehost.co.ke\/support\/wp-content\/uploads\/2018\/08\/1-3.png\" alt=\"\" width=\"948\" height=\"243\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/1-3.png 948w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/1-3-300x77.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/1-3-768x197.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/1-3-50x13.png 50w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/1-3-920x236.png 920w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/1-3-600x154.png 600w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/1-3-320x82.png 320w\" sizes=\"auto, (max-width: 948px) 100vw, 948px\" \/><\/p>\n<p>b)Scroll down to <b>MySQL Users.<\/b> Select a username and password. NB: Note this password as you will need it in your database connection script.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5491\" src=\"https:\/\/www.truehost.co.ke\/support\/wp-content\/uploads\/2018\/08\/2-4.png\" alt=\"\" width=\"1334\" height=\"486\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/2-4.png 1334w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/2-4-300x109.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/2-4-768x280.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/2-4-1024x373.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/2-4-50x18.png 50w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/2-4-920x335.png 920w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/2-4-600x219.png 600w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2018\/08\/2-4-320x117.png 320w\" sizes=\"auto, (max-width: 1334px) 100vw, 1334px\" \/><\/p>\n<p>c) Click<b> Save<\/b>.<\/p>\n<p>3. Database name.<\/p>\n<p>You need to first create a database in <b>MySQL databases<\/b> link before it can appear in <b>phpMyAdmin.<\/b> To create one:<\/p>\n<p>a)Access cpanel and scroll to <b>MySQL Databases<\/b>. Click it<\/p>\n<p>b)Under <b>Create Database<\/b>, enter the name of your database. Note that, like MySQL users above, the database will have the cpanel username prepended to it.<\/p>\n<p>c) Click <b>Create.<\/b><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To connect to MySQL database, you neeed the following pieces of information. 1. Hostname Use localhost as hostname at all time. If localhost does not work, use 127.0.0.1 2. Username This is the user who has privileges to access the database and make changes to it. In cpanel, this user is normally created to include [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_eb_attr":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"doc_category":[],"doc_tag":[],"class_list":["post-5489","docs","type-docs","status-publish","hentry"],"year_month":"2026-06","word_count":182,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"w m","author_nicename":"wm","author_url":"https:\/\/truehost.com\/support\/author\/wm\/"},"doc_category_info":[],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Connection settings for MySQL databases -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Connection settings for MySQL databases -\" \/>\n<meta property=\"og:description\" content=\"To connect to MySQL database, you neeed the following pieces of information. 1. Hostname Use localhost as hostname at all time. If localhost does not work, use 127.0.0.1 2. Username This is the user who has privileges to access the database and make changes to it. In cpanel, this user is normally created to include [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-07T13:03:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.truehost.co.ke\/support\/wp-content\/uploads\/2018\/08\/1-3.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/connection-settings-mysql-databases\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/connection-settings-mysql-databases\\\/\",\"name\":\"Connection settings for MySQL databases -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/connection-settings-mysql-databases\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/connection-settings-mysql-databases\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.truehost.co.ke\\\/support\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/1-3.png\",\"datePublished\":\"2018-08-22T05:36:45+00:00\",\"dateModified\":\"2024-06-07T13:03:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/connection-settings-mysql-databases\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/connection-settings-mysql-databases\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/connection-settings-mysql-databases\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.truehost.co.ke\\\/support\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/1-3.png\",\"contentUrl\":\"https:\\\/\\\/www.truehost.co.ke\\\/support\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/1-3.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/connection-settings-mysql-databases\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/truehost.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Connection settings for MySQL databases\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"name\":\"\",\"description\":\"Help In a Click\",\"publisher\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/truehost.com\\\/support\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\",\"name\":\"Truehost Kenya\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"width\":240,\"height\":48,\"caption\":\"Truehost Kenya\"},\"image\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Connection settings for MySQL databases -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/","og_locale":"en_US","og_type":"article","og_title":"Connection settings for MySQL databases -","og_description":"To connect to MySQL database, you neeed the following pieces of information. 1. Hostname Use localhost as hostname at all time. If localhost does not work, use 127.0.0.1 2. Username This is the user who has privileges to access the database and make changes to it. In cpanel, this user is normally created to include [&hellip;]","og_url":"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/","article_modified_time":"2024-06-07T13:03:36+00:00","og_image":[{"url":"https:\/\/www.truehost.co.ke\/support\/wp-content\/uploads\/2018\/08\/1-3.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/","url":"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/","name":"Connection settings for MySQL databases -","isPartOf":{"@id":"https:\/\/truehost.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/#primaryimage"},"image":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/#primaryimage"},"thumbnailUrl":"https:\/\/www.truehost.co.ke\/support\/wp-content\/uploads\/2018\/08\/1-3.png","datePublished":"2018-08-22T05:36:45+00:00","dateModified":"2024-06-07T13:03:36+00:00","breadcrumb":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/#primaryimage","url":"https:\/\/www.truehost.co.ke\/support\/wp-content\/uploads\/2018\/08\/1-3.png","contentUrl":"https:\/\/www.truehost.co.ke\/support\/wp-content\/uploads\/2018\/08\/1-3.png"},{"@type":"BreadcrumbList","@id":"https:\/\/truehost.com\/support\/knowledge-base\/connection-settings-mysql-databases\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/truehost.com\/support\/"},{"@type":"ListItem","position":2,"name":"Connection settings for MySQL databases"}]},{"@type":"WebSite","@id":"https:\/\/truehost.com\/support\/#website","url":"https:\/\/truehost.com\/support\/","name":"","description":"Help In a Click","publisher":{"@id":"https:\/\/truehost.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/truehost.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/truehost.com\/support\/#organization","name":"Truehost Kenya","url":"https:\/\/truehost.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","width":240,"height":48,"caption":"Truehost Kenya"},"image":{"@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/5489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/comments?post=5489"}],"version-history":[{"count":1,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/5489\/revisions"}],"predecessor-version":[{"id":5492,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/5489\/revisions\/5492"}],"wp:attachment":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/media?parent=5489"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_category?post=5489"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_tag?post=5489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}