Prophidys / RTG2

Realtime Traffic Grapher 2
GNU General Public License v2.0
11 stars 9 forks source link

createdb creates database, but no tables #54

Open 4001982248998 opened 6 years ago

4001982248998 commented 6 years ago

Trying to work around #53, I replaced mariadb with mysql 5.7, confronting me with a new problem:

createdb creates the database, but no tables. This is the command output:

sudo /usr/local/rtg2/etc/createdb mysqlrootpass

/usr/local/rtg2/etc/createdb setting up MySQL database for RTG.
Using MySQL binaries in /usr/bin.

Adding user "snmp" to MySQL database...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1054 (42S22) at line 1: Unknown column 'Password' in 'field list'
Creating RTG database "rtg"...
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Reloading MySQL privileges...
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Creating RTG tables...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'snmp'@'localhost' (using password: YES)
Done.
4001982248998 commented 6 years ago

I found out that since mysql 5.7, the row user.password has been renamed to user.authentication_string, so the script must be updated accordingly.

4001982248998 commented 6 years ago

I am not good at this. So the syntax to create SQL users has been quite overhauled.

Would this be better?

--- etc/createdb        2018-01-19 10:57:14.300834370 +0100
+++ /usr/local/rtg2/etc/createdb        2018-01-19 12:19:38.841813652 +0100
@@ -23,11 +23,8 @@

 # Create the necessary SQL in two /tmp files
 cat <<EOT >/tmp/mysql.sql
-INSERT INTO user (Host, User, Password) VALUES ('$HOST','$USER',PASSWORD("$RTGPASS"));
-INSERT INTO db (Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
-Create_priv, Drop_priv, Grant_priv, References_priv, Index_priv, Alter_priv)
-VALUES ('$HOST','$DATABASE','$USER','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
-FLUSH PRIVILEGES;
+CREATE USER '$USER'@'localhost' IDENTIFIED BY '$RTGPASS';
+GRANT ALL PRIVILEGES ON rtg.* TO '$USER'@'localhost';
 EOT

 cat <<EOT >/tmp/rtg.sql