Cheap Web Space, Domain Name:
Web Space With E-Mail, PHP/MySQL.

My PHP script cannot log into the database even though all login data are correct

Question: 

Searching …

 

Unfortunately nothing found on "".

Premium support for Bitpalace web hosting customers only!

 from the Bahamas: +49 30 32 70 18 92, Fax (in Germany) +49 30 32 70 18 91

service@bitpalast.net 

Skype: bitpalast

One moment please … your browser is loading the page.

 

 

Symptom

You're using a PHP code similar to this:

$hostname = 'localhost:3306';
$username = 'cu-loginname01_user01';
$password = 'Dbng%3r92';
$dbname = 'cu-loginname01_db01';
$db = mysqli_connect($hostname, $username, $password, $dbname) or die('login failed');

You are sure that the database login name and database password are correct. Nevertheless no login succeeds.

 

Cause

The database differentiates between host name and port. If you give a user permission to access the host "localhost", it is different than if it is called "localhost:3306". The database does not know a suitable user data record for “localhost:3306”.

 

Solution

Omit the port specification. If you want to specify a port, this must at least be passed separately as a port to the PHP mysqli_connect() function. The correct PHP code for the example would be:

$hostname = 'localhost';
$port = '3306';
$username = 'cu-loginname01_user01';
$password = 'Dbng%3r92';
$dbname = 'cu-loginname01_db01';
$db = mysqli_connect($hostname, $username, $password, $dbname, $port) or die('login failed');

or

$hostname = 'localhost';
$username = 'cu-loginname01_user01';
$password = 'Dbng%3r92';
$dbname = 'cu-loginname01_db01';
$db = mysqli_connect($hostname, $username, $dbname, $password) or die('login failed');

 

Overview of frequently asked questions 

 

 

 


 

Additional Services

Starter Server: Affordable web server from  2.24 US$ () /month with PHP, database and many more 

Online Reservation System: Occupancy & vacancy schedule for any ressources (vehicles, sports facilities …) & guest houses, holiday apartments …  1.04 US$ () /month 

Software development: Development of database applications, programming and revision of computer programs & scripts  18.78 US$ () /hour 

 

FAQ – frequently asked questions 

 

Cuba

Austria

Kenya

Guyana

Lesotho

Liberia

Antigua and Barbuda

Papua New Guinea

Paraguay

Cameroon

Argentina

Germany

Australia

Dominican Republic

Barbados

Madagascar

Belize

Bolivia

Peru

Uganda

India

Philippines

Malta

Botswana

Chile

Marshall Islands

Costa Rica

Puerto Rico

Ireland

Mauritius

Rwanda

Saint Kitts and Nevis

Saint Vincent and the Grenadines

Saint Lucia

Mexico

Zambia

Samoa

Jordan

Micronesia, Federated States of

Switzerland

Dominican Republic

Malawi

Seychelles

Namibia

Kiribati

Ecuador

Nauru

Sierra Leone

New Zealand

El Salvador

Singapore

Fiji

Gambia

Solomon Islands

Ghana

Spain

Nicaragua

Sudan

Nigeria

Swaziland

South Africa

Pakistan

Palau

Tanzania, United Republic of

Colombia

Grenada

Tonga

Trinidad and Tobago

Honduras

Tuvalu

Uruguay

Panama

Venezuela

United States

Jamaica

Canada

Guatemala

Guinea

United Kingdom

Zimbabwe

 

"Cheap Web Space": Affordable web space, cheap web server, low-cost webserver, low-price web servers: fast web server / small web server (cheap web space). Web server for private homepages / small website projects.

  from the Bahamas: +49 30 32 70 18 92 •  GmbH, Sensburger Allee 27, D-14055 Berlin (Germany)
Your purchase is tax-free, because you order from a non-EU country. © 2024  GmbH. All rights reserved. and the logo are registered trademarks of GmbH. For photo credits see imprint.

Imprint Privacy policy Sitemap