Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: How can we check

  1. #21
    Join Date
    Sep 2012
    Location
    Guntur
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How can we check

    Quote Originally Posted by ofnuts View Post
    The "canonical" way (pardon the pun) is to provide an installation package for your stuff (.DEB file) with a dependency on mysql, so that the package manager install mysql if it's not installed when someone installs your package.

    You cannot depend on the user's ability to install packages when your script is run. He could be a plain user with no privileges.
    How can i do that?? i mean without depending on the user ability to install packages when my script is run???

    how can i connect to Database automatically and execute mysql commands...

    like i have to connect to database automatically and show the databases..

    but when i tried like this it showed me no results

    Code:
    mysql -u root -p #Since it will prompt the user for the root password
    show databases;
    what i am getting is

    it is prompting me for password all right but it is not executing the show databases; command why so??

  2. #22
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,172
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: How can we check

    Quote Originally Posted by Mohan1289 View Post
    How can i do that?? i mean without depending on the user ability to install packages when my script is run???
    As I said... you make sure that when your script is installed (*)(because before being run, it must be installed) it drags with it the required mysql installs. This what the package manager in Linux distributions is all about. Individual packages (here, the one with your script) list their dependencies and the package manager makes sure the required packages get also installed. So your script doesn't need to worry about mysql, because if it's there and running, then the package manager also made sure mysql would be available.

    This is the standard way of making sure your needed packages will be available but it is rather theoretical when it comes to databases: these things always require some setup to work efficiently and in any case installing an RDBMS is not a trivial thing on a system, it has consequences (RAM and CPU usage, even when not in use, backups...) so in practice you can't really install it implicitly. Furthermore these often run on a different system, you can only have a dependency on the RDBMS client, and hope that the server part is already available somewhere. So here it would be completely legitimate to just state the dependency and expect a system administrator to install mysql independently (this would also leave him the choice of the edition of mysql).

    (*) and it is of course installed by someone who has the privileges to do so...
    Last edited by ofnuts; November 6th, 2012 at 11:24 AM.

  3. #23
    Join Date
    Sep 2012
    Location
    Guntur
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How can we check

    Quote Originally Posted by ofnuts View Post
    As I said... you make sure that when your script is installed (*)(because before being run, it must be installed) it drags with it the required mysql installs. This what the package manager in Linux distributions is all about. Individual packages (here, the one with your script) list their dependencies and the package manager makes sure the required packages get also installed. So your script doesn't need to worry about mysql, because if it's there and running, then the package manager also made sure mysql would be available.

    This is the standard way of making sure your needed packages will be available but it is rather theoretical when it comes to databases: these things always require some setup to work efficiently and in any case installing an RDBMS is not a trivial thing on a system, it has consequences (RAM and CPU usage, even when not in use, backups...) so in practice you can't really install it implicitly. Furthermore these often run on a different system, you can only have a dependency on the RDBMS client, and hope that the server part is already available somewhere. So here it would be completely legitimate to just state the dependency and expect a system administrator to install mysql independently (this would also leave him the choice of the edition of mysql).

    (*) and it is of course installed by someone who has the privileges to do so...

    can you Please give me a Example so that i can understand??
    Last edited by Mohan1289; November 8th, 2012 at 06:03 AM.

Page 3 of 3 FirstFirst 123

Bookmarks

Posting Permissions

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