Page 1 of 1

vestacp with mysql 8 under ubuntu 18.04

Posted: Wed Sep 18, 2019 3:16 pm
by fasttrackhost
If you plan on updating mysql to version 8 you must change in vesta config:

1. cd /usr/local/vesta/bin

2. nano v-add-database

3. Search for line

Code: Select all

# Create MySQL database
4. Add after:

Code: Select all

    query="CREATE DATABASE \`$database\` CHARACTER SET $charset"
    mysql_query "$query" > /dev/null
these lines:

Code: Select all

    query="CREATE USER \`$dbuser\`@\`$host\` IDENTIFIED BY '$dbpass'"
    mysql_query "$query" > /dev/null

    query="ALTER USER \`$dbuser\`@\`$host\` IDENTIFIED WITH mysql_native_password BY '$dbpass'"
    mysql_query "$query" > /dev/null
In our tests we had to change the next 2 query lines and make them look like these:

Code: Select all

    query="GRANT ALL ON \`$database\`.* TO \`$dbuser\`@\`%\`"
    mysql_query "$query" > /dev/null

    query="GRANT ALL ON \`$database\`.* TO \`$dbuser\`@localhost"
    mysql_query "$query" > /dev/null
This change should not be a problem.

Very important, mysql must be configured tu authenticate using "mysql_native_password", so in mysql configuration file (/etc/mysql/my.cnf ) under [mysqld] add:
default_authentication_plugin = mysql_native_password

Code: Select all

[mysqld]
default_authentication_plugin = mysql_native_password
Adding, suspending and deleting database and user works fine. No more changes needed.

Re: vestacp with mysql 8 under ubuntu 18.04

Posted: Mon May 23, 2022 1:20 am
by andrewc2
For an existing install other than backing everything up first, would you update mysql first then make these changes?