My requirement is to create a user for remote login but without a password. At my remote space I use a bash script to do inserts, which is something like:
for i in {1..5000}; do mysql -h 11.40.3.169 -uUser -pPass -DDatabaseName <<< "insert into DatabaseTableName values('$i','dummy_$i');" & echo -n "$i " sleep 1 date done
The problem is that each insert is taking almost 4 seconds, and I can not pinpoint the problem to anything but authentication at every insert. So, if I could create a user in MySQL with minimal authentication involved...Something like:
# I'm trying to remove this password GRANT ALL PRIVILEGES TO 'user'@'%' IDENTIFIED BY 'password';
...Anything you can suggest.
Step 1: Open the MySQL server by using the mysql client tool. Step 2: Enter the password for the account and press Enter. Step 3: Execute the following command to show all users in the current MySQL server. Step 4: Create a new user with the following command.
To GRANT ALL privileges to a user , allowing that user full control over a specific database , use the following syntax: mysql> GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';
Just remove the IDENTIFIED BY
part:
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%'
Note that remote login from anywhere without a password is a very insecure thing. You better limit the allowed IP
range for this user:
GRANT ALL PRIVILEGES ON *.* TO 'user'@'allowed_remote_machine'
You can do this by creating a user with a password and then placing a .my.cnf file in the home directory of the account which runs the bash script containing the following:
[mysql] user=user password=pass [mysqladmin] user=user password=pass
This might be better than creating a user with no password.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With