Category Archives: Mysql

PostgreSQL remote connection

Problem: Cannot connect remotely mysql or postgresql

Solution:

Allow ports 3306 for mysql or 5432 for pgs.

Go to /etc/mysql/mariadb.conf.d/50-server.cnf and change bind-address = 0.0.0.0. Restart mysql pr maria actually.

Go to hestiacp postgresql configuration part. Go and change listen_addresses = ‘*’, remove comment. Restart psg.

Done.

MySQL import/export dump timestamp problem

I have just lost 4 hours today for a simple export import problem. Why it always has to be that way?!?!?

I had to transfer ip of the domain with the data and of course db. Like always everything was smooth but after trying domain (after dns change) I had to pictures online?!

I have tried everything. Problem was simple (after the battle everyone are generals) – it was mysql :

Dump TIMESTAMP columns in UTC (enables TIMESTAMP columns to be dumped and reloaded between servers in different time zones)

Mysql columns were using timestamps because of the start and end date (23:59:59) for local time BUT when exporting that option was clicked and made strange dates on the importing mysql server.

After unchecking this box time was still strange but at least dates were not going -1 day.

PHP Mysql extending class

So, lets say you want to extend php/mysql class we were talking about earlier.

class nastavak extends baza {

private $nast;
private $drugi;

public function __construct(){
echo "This is the extended class";
parent::__construct("","root","","test");
parent::sqlquery("select * from imena");
parent::stampaj();
}
}

What happened here? Well, we have added another class on top of baza class and that way we have extended it. It means new class (extended) has everything from parent class (baza) and what we have added inside of it (nastavak).

Overriding in the next article.

Phpmyadmin and creating views

I’ve just lost 10 seconds of my life to find out how to create views in phpmyadmin and it was pretty simple.

Just do some query or search something from your database. You should now have some sql query. Now take a look down there bellow. You should see create view. Go for it. Enter the view name and enter the columns. Go. Now you have your create view table. Refresh localhost databases. Your table should be there added bellow other tables.

That’s it.