The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

User Access to Database

Discussion in 'Database Discussions' started by Steve Kessler, Jun 27, 2015.

  1. Steve Kessler

    Steve Kessler Active Member

    Joined:
    Feb 22, 2015
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Denver, Colorado, United State
    cPanel Access Level:
    Root Administrator
    I am trying ensure the user I am running a bash script with has full access to my database via a my.conf file that specifies a valid username and password. I tried to locate the my.conf on my system and I do not see a way to do that. I think I know what I need to add to my.conf file but I am not sure where it is with cPanel.

    Thanks!
     
  2. dalem

    dalem Well-Known Member
    PartnerNOC

    Joined:
    Oct 24, 2003
    Messages:
    2,577
    Likes Received:
    40
    Trophy Points:
    48
    Location:
    SLC
    cPanel Access Level:
    DataCenter Provider
    located in your /home/usename and its .my.cnf (its hidden)
     
  3. feldon27

    feldon27 Well-Known Member

    Joined:
    Mar 12, 2003
    Messages:
    111
    Likes Received:
    11
    Trophy Points:
    18
    Location:
    Houston, TX
    I'm curious why you need a my.cnf file to do a bash script. Have you tried something like:

    #!/bin/sh
    fdb=feldon30_testforum
    fuser=feldon30
    fpw=U$fkds0431
    fdate=`eval date +%Y-%m-%d`

    mysql -u $fuser -p$fpw -D $fdb -e "UPDATE tracking SET lastupdate=$fdate;"​
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Have you considered authenticating with a MySQL username/password directly in the script as referenced in the previous post?

    Thank you.
     
Loading...

Share This Page