Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createdb creates database, but no tables #54

Open
4001982248998 opened this issue Jan 19, 2018 · 2 comments
Open

createdb creates database, but no tables #54

4001982248998 opened this issue Jan 19, 2018 · 2 comments

Comments

@4001982248998
Copy link

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
Copy link
Author

4001982248998 commented Jan 19, 2018

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant