Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

MySQL

  • 03-02-2003 8:42pm
    #1
    Closed Accounts Posts: 5,362 ✭✭✭


    Can anyone tell a beginner like me how to set a database Ive made as the default when starting up the MySQL server? Im using a windows machine. Cheers!


Comments

  • Registered Users, Registered Users 2 Posts: 277 ✭✭Lawnkiller


    how are you connecting to the server.


  • Closed Accounts Posts: 5,362 ✭✭✭Trotter


    I have the mysql icon on my desktop and when I open that it goes straight into a command line box and gives me a mysql> prompt.

    The server runs when I start the machine. I didnt set it up that way, its just the way it is.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    USE dbname
    

    And RTFM while yop're at it :mad:


  • Closed Accounts Posts: 5,362 ✭✭✭Trotter


    I did read the manual. I also know about the USE database. What Im looking for is the server to use my database automatically from startup without typing USE, i.e. when the server starts it goes straight to my db.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    What do you mean by server to use your database automatically? What software do you want to connect to the database? A scripting languages like ASP or PHP? Another database? Explain, as you're not really saying what you want to do.


  • Advertisement
  • Closed Accounts Posts: 7,563 ✭✭✭leeroybrown


    TO open mysql the normal command is:

    mysql -u username -p

    (the -p flag is to ask for a password prompt)

    To specify a database to USE you can add the name to the end of the command:

    mysql -u username -p dbname

    So, considering that your desktop icon is probably just a shortcut of some sort you can just add the dbname to the string describing the shortcut.


  • Registered Users, Registered Users 2 Posts: 1,186 ✭✭✭davej


    I'm not sure exactly what you're looking for but there are a number of ways to reference a particular database within mysql:

    EG if using jdbc to connect, you can use a url thus:

    url= "jdbc:mysql://myhost.com:3306/dbname/"

    I don't think there is a way to assign a default database to a user like the way you can with MS Sql Server. With MS SQL you automatically connect to your user's default database without having to mention it explicitly in a connect command.


    davej


Advertisement