Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Posts
    20

    Unanswered: Creating user in mysql through shell script

    Hai !
    I am trying to create a new user in mysql through shell script. I want to import the database and try to assign permissions to that user for the database.

    Thanks in advance. Waiting for ur quick reply.

    Regards,
    Prasanthi

  2. #2
    Join Date
    Jan 2003
    Location
    Paris, France
    Posts
    320
    you can simply create a sql file like this

    #create the db

    create database dbname

    #create tables

    use dbname

    create table .......

    # import data using load data or complet insert

    # create users

    grant [priv] on dbname.[* | tablename] to ....

    # flush privilege


    And call mysql in a shell script

    mysql -u [user] -p [pass] < pathto your file.sql
    Olivier Miossec
    --
    http://www.lasso-developpeur.net/
    --

  3. #3
    Join Date
    Dec 2003
    Posts
    20
    Hi !

    Thanks for ur suggestion.l created a backup.sql file and followed ur instructions. but I am getting the error after running shell script.
    the Error is :" Access Denied For User: 'venus1@localhost' (Using Password:YES)

    For granting privileges, I used the grant command like this:
    grant all privileges on dbfirst.* to venus1@'localhost' identified by 'venus1' with grant option;

    Waiting for ur reply.
    Bye
    Prasanthi

  4. #4
    Join Date
    Jan 2003
    Location
    Paris, France
    Posts
    320
    did you flush user privileges
    Olivier Miossec
    --
    http://www.lasso-developpeur.net/
    --

  5. #5
    Join Date
    Dec 2003
    Posts
    20
    Hi!
    Thanks, I got the solution.

    Bye
    Prasanthi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •