islamic_programmer
islamic_programmer

Reputation: 244

how to enable root access to remote when Configure mysql instance?

I created a batch file for silent install and configure mysql.

following:

msiexec /i "mysql-5.5.21.msi" /quiet INSTALLDIR="%pro%\MySQL\MySQL Server 5.5"


 MySQLInstanceConfig.exe -i -q "-lC:\mysql_install_log.txt" "-nMySQL Server 5.5" "-p%pro%\MySQL\MySQL Server 5.5" -v5.5.21 "-t%pro%\MySQL\MySQL Server 5.5\my-template.ini" "-c%pro%\MySQL\MySQL Server 5.5\my.ini" ServerType=DEVELOPMENT DatabaseType=MIXED ConnectionUsage=OLTP Port=3306 ServiceName=Mysql Charset=utf8 RootPassword=m117988m

how to enable root access to remote With MySQLInstanceConfige.exe in batch file?

Upvotes: 1

Views: 5021

Answers (1)

Jürgen Steinblock
Jürgen Steinblock

Reputation: 31743

According to the MySQL docs, there is none.

http://dev.mysql.com/doc/mysql-windows-excerpt/5.1/en/mysql-config-wizard-cmdline.html

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:

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

or another way that does not add another user entry but configures the existing one to allow remote connections.

mysql.exe -u root -pm117988 -e "UPDATE mysql.user SET host = '%' WHERE host = 'localhost' AND user = 'root';

You could even provide a sql file for setting up your database after installation. That file could contain this command and even creating a database/tables/data for you.

mysql.exe -u root -pm117988 < post_install_script.sql

Upvotes: 2

Related Questions