Frage

I have trying to make GRANT ACCESS to a MySQL Server user.

I have wrote following command in mybatch.bat :

@echo off

cd /
c:

set mysql_cmd = "GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'192.168.1.%' IDENTIFIED BY '123abc' WITH GRANT OPTION;"

mysql --user=root --password=mysql --database=mysql -e %mysql_cmd%

pause

mybatch.bat Output is :

mysql: option '-e' requires an argument

What am i doing wrong?

War es hilfreich?

Lösung

And that makes sense because it only configures settings that don't need the database running.

            ->Creating a Service
            ->Creating/Modifying a my.ini file
            ->Configuring a Windows Firewall Exception
            ->Adding the install dir to the path Environment variable

However. You could use mysql.exe command line tool to script this after your instance is up and running:

usefollowing command

mysql.exe -u root -pm117988 -e "GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'm117988' WITH GRANT OPTION; FLUSH PRIVILEGES;"

Andere Tipps

Wrap %mysql_cmd% in double quotes

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top