INSTALLATION AND SETUP
Type g++ --version to see if C++ is installed. Type mysql --version to see if MYSQL or Mariadb is installed. Use your package manager to install the following packages if you don’t already have them.
sudo apt install libboost-all-dev sudo apt install mysql-server (or mariadb) sudo apt install mysql-client (or mariadb-client) sudo apt install libmysqlcppconn-dev
You can find the world database schema at https:/dev.mysql. com/doc/index-other.html. Download and unzip world.sql.
To start MYSQL or Mariadb (if necessary):
sudo systemctl start mysql.service
To set the root password for MYSQL (if necessary):
mysql-secure-installation
To find out on what port MYSQL/MARIADB is listening:
sudo ss -tlpn | grep mysql
This should indicate 127.0.0.1:3306, which is localhost on port 3306. The port number should match the value shown in the saddress argument to the Database ctor .
Try to log in to MYSQL or Mariadb with mysql -u root -p and enter the root MYSQL password. This password is not necessarily the same as the Linux root password. If you can’t log in, try sudo mysql -u root. If you can only log in to MYSQL with sudo and without a root password, try the following at the MYSQL prompt:
SELECT User, Host FROM mysql.user;
You should see the user root@localhost. Delete the root@localhost
account:
DROP User ‘root’@’localhost’;
Recreate root user:
CREATE User ‘root’@’%’ IDENTIFIED BY ‘your-new-rootpassword’;
Give permissions to root user:
GRANT ALL PRIVILEGES ON *.* to ‘root’@’%’ WITH GRANT
OPTION;
FLUSH PRIVILEGES; quit;
Now try to log in to MYSQL or Mariadb as root with your new password without using sudo. mysql -u root -p
Enter your new root password at the prompt. This should set things up so that you can use MYSQL normally.