How to create a MySQL user without password - needed for remote login - to be used in bash insert script?

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.


I think your problem lies in the fact that you are starting the mysql client for each insert. You should be doing your inserts from a php, java, etc program - not from a shell script.

The startup time of the client (and connection to the host) is killing you. I routinely do 1000s of inserts per minute from a php or java program to a MySQL database with millions of records on a small (CPU/memory) machine.

Tags:

Mysql

Bash