Have you ever experienced problems in Building a website like the picture above ?? Error establishing a connection Data information error such as incorrectly entering Database, Username, and Password in wp-config.php or not having Database, Username and password in Mysql/Phpmyadmin. For Friends, it turns out to be very easy to overcome errors making database connections on Ubuntu/Linux.
1. This Step if you do not have a database.
Install Mysql (open Terminal/Consule and as root)
apt-get install mysql-server
Create a strong password when installing mysql server.
Note*** if when installing mysql there is no Mysql password configuration we can create password manually.
mysql -u root -p
mysql> create database wordpress;
At this stage we have created a mysql database (you can create a database name according tou your wishes, it’s free, in my example I created a database with the name WordPress.
2. In this Step, you don’t have a root user and Mysql password, if you already have a database, root user, and mysql password, skip step 1 and 2.
Create user root & Password Mysql
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘passwordMySQL’;
Note** Change passwordMysql with your password.
Restart your apache, type in terminal ;
systemctl restart apache2
3. You enter the database, Username and password that you created earlier or if you already have edit wp-config.php.
Syntax folder name WordPress adjust to with you created ;
Note *** Do not enter the wrong database, username and password, this is what causes the “error establishing data connection” and pay attention to the quotes, commas, spaces etc., don’t let anything go wrong.
define( ‘DB_NAME’, ‘wordpress’ );
define( ‘DB_USER’, ‘root’ );
define( ‘DB_PASSWORD’, ‘the password your created’ );
then restart apache systemctl restart apache2 (When using apache)
Then Enter Domain/Ipaddress in the Browser whether you can enter WordPress.
How easy isn’t it?? How To Fix Error Establishing a Database Connection, If there is something you don’t understand, please make ask in the comment or you can contact me via email on our contact page.
Hopefully this article can be useful for all friends..