문제

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?

도움이 되었습니까?

해결책

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;"

다른 팁

Wrap %mysql_cmd% in double quotes

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top