What should I do if phpcms v9 cannot connect to the database?
The database password is special characters. When installing phpcms, the error message "Unable to connect to the database server" appears. Please check the configuration, but the database information is completely correct
Reason: The database password is a special character.
When installing phpcms, it appears that the database server cannot be connected. Please check the configuration, but the database information is completely correct.
I searched a lot on the Internet but could not solve the problem. Later I found out that it was the database password. There are two ways to solve this problem if there are special characters "such as: !@#".
The first is to change the database password, but this is not particularly good, right,
The second Two methods: modify two places in total
1. Modify around line 127 of install/step/step5.tpl.php
Replace:
var url = '?step=dbtest&dbhost='+$('#dbhost').val()+'&dbuser='+$('#dbuser').val()+'&dbpw='+$('#dbpw').val()+'&dbname='+$('#dbname').val()+'&tablepre='+$('#tablepre').val()+'&sid='+Math.random()*5;
with:
var url = '?step=dbtest&dbhost='+$('#dbhost').val()+'&dbuser='+$('#dbuser').val()+'&dbpw='+'&dbpw='+escape($('#dbpw').val())+'&dbname='+$('#dbname').val()+'&tablepre='+$('#tablepre').val()+'&sid='+Math.random()*5;
Start your phpcms journey!!!
PHP Chinese website, a large number of free PHPCMS tutorials, welcome to learn online!
The above is the detailed content of What to do if phpcms v9 cannot connect to the database. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool