Skip to content

Instantly share code, notes, and snippets.

@enthusiasmus enthusiasmus/blog.md
Last active Aug 12, 2018

Embed
What would you like to do?
Stuff I solved during me hacking journeys

Cocktail DB-Draft

Zutaten-Tabelle ID Name

Cocktail-Tabelle ID Name Art Zubereitung Glas

Cocktail-hat-Garnitur-Tabelle ID Zutaten-ID Cocktail-ID Menge

Cocktail-hat-Zutat-Tabelle ID Zutaten-ID Cocktail-ID Menge

MySQL 8.0.11 with Wordpress 4.8.6

I got following error when trying to open the blog in the browser.

Warning: mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client in /var/www/danceteam-salzburg.at/wp-includes/wp-db.php on line 1603

So I created a new user with the authentification handler mysql_native_password (instead of the default caching_sha2_password) and granted permissions.

CREATE USER '<user>'@'localhost' IDENTIFIED WITH mysql_native_password BY '<password>';
GRANT ALL PRIVILEGES ON <database> . * TO '<user>'@'localhost';
FLUSH PRIVILEGES;

Normally that should work, but it didn't. So I added following line to the config file of mysql:

default_authentication_plugin=mysql_native_password

If this does not work you can choose the retain old authentification method option during the installation.

Restarted MySQL and imported the dump via

mysql -u <user> -p <database> < dump.sql

Datenbank liegt dann unter /var/lib/mysql Konfigurationsdatei ist diese Datei hier: /etc/mysql/mysql.conf.d/mysqld.cnf

Update Wordpress database after relocation

UPDATE wp_options SET option_value="<url>" WHERE option_id=2;
UPDATE wp_options SET option_value="<url>" WHERE option_id=1;

Fix wordpress permissions

cd /var/www/
sudo chown www-data:www-data * -R
cd blog
sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;
# wp-content only should be writeable by everyone eql. www-data
sudo chown -R <user>:<user> *
sudo chown -R www-data:www-data wp-content

Set upload max body size for wordpress themes

sudo vi /etc/nginx/nginx.conf

http {
    ...
    client_max_body_size 200M;
}    

sudo vi /etc/php/7.0/fpm/php.ini

upload_max_filesize = 200M
sudo service nginx restart
sudo service php7.0-fpm restart

Dump MySQL table

mysqldump -u root -p <database> > <database>.sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.