peter b's picture

I have created an SQL database, but need instruction / help on how to access externally and internally.

I ran:

sed -i "s/^bind-address/#bind-address/" /etc/mysql/my.cnf

then the $MYSQL_BATCH  gives a command not found, and I don't know why: Host as ip address, user & pw same as in MYSQL_BATCH comand

MYSQL_BATCH="mysql --user=root --password=$MYSQL_PASS --batch"

$MYSQL_BATCH --execute "INSERT INTO mysql.user ( Host , User , Password , Select_priv ,
    Insert_priv , Update_priv , Delete_priv , Create_priv , Drop_priv , Reload_priv , 
    Shutdown_priv , Process_priv , File_priv , Grant_priv , References_priv , 
    Index_priv , Alter_priv , Show_db_priv , Super_priv , Create_tmp_table_priv , 
    Lock_tables_priv , Execute_priv , Repl_slave_priv , Repl_client_priv , 
    Create_view_priv , Show_view_priv , Create_routine_priv , Alter_routine_priv , 
    Create_user_priv , ssl_type , max_questions , max_updates , max_connections , 
    max_user_connections) VALUES ( '%', 'root', '', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
    'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y','Y', 'Y', 'Y', 'Y', 'Y',
    'Y', 'Y', 'Y', 'Y', '', '0', '0', '0', '0');"

and

/etc/init.d/mysql restart

 

I have Created a database

I have Created a database user and password in MySQL Server Configuration -> User Permission

I have set up MySQL Server Configuration -> Database Permissions to allow user from any host to edit

I have set up MySQL Server Configuration -> Host Permissions to ANY

I have added ACCEPT If protocol is TCP and destination port is 3306 in the Firewall

 

for EXTERNAL: I assume the host is the ip address, and the username and pw are based on the admin OR the database user and pw.

for INTERNAL: I assume the host is localhost.

Can anyone what is missing in these steps? Why MYSQL_BATCH is getting command not found

 

Thanks

Forum: 
Tags: 
Jeremy Davis's picture

Perhaps the copy/paste isn't working properly for some reason. If you look at the code, the first part sets the variable MYSQL_BATCH as the mysql command string for your MySQL account then the second part executes the variable and feeds the values to change in... So MYSQL_BATCH isn't a command, nor is it meant to be...!

The next bit you talk about "MySQL Server Configuration", is that in Webmin? Theoretically it should work but I have never used it, maybe it's got a bug?. Personally I much prefer to use phpMyAdmin (which is preinstalled on most TKL appliances that also contain MySQL, on port 12322 - if not, it's easy to install). IMO phpMyAdmin is a powerful, user friendly DB WebUI so I have never had the need or desire to use Webmin for MySQL.

Also you mention the firewall. By default it is disabled, however if you are running on AWS the you will need to adjust the Security Profile (the AWS firewall) for your instance (the Hub provides an easy way to do that).

Add new comment