FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


mysql adding new user with shell





ralcantara
Hi People,

Here is a simple shell script to add a new user in mysql

=======================================
#!/bin/bash

mysql -uroot -e"
CREATE USER '$1'@'%' IDENTIFIED BY '$2';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION;
"

========================================

You can use so it:
$ ./script.sh <new user> <password>

Wink
rickylau
ralcantara wrote:
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION;

Wow... granting all privileges to a user seems not to be a good idea. Normally some basic permissions like INSERT, SELECT, ALTER and DELETE are needed, it is not necessary to grant everything to new users.
Related topics
A very good PHP MySQL Tutorial
New user here
New User: Duder673
I AM NEW USER HELP ME !
how to create a new user in sql
New user username box explanation
New User
New User
Nom de domaine gratuit
AJAX tutorial [2nd part now updated]
Adding new style templates after modding a phpbb
Frustrations setting up new FTP account! HELP!
Flat file-based, MySQL-based counter
MySQL Database...unique usernames
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.