Results 1 to 5 of 5

Thread: Connect to MySQL from command line on Ubuntu

  1. #1
    Join Date
    Sep 2003
    Posts
    3,040

    Default Connect to MySQL from command line on Ubuntu

    MySQL comes with command line tool "mysql" that can be used to connect to MySQL and manage database.

    To connect to MySQL, you should know MySQL username and password.

    Connect to MySQL

    Code:
    mysql -u root -p
    It will ask you password.

    Some Basic Commands

    Show all databases.


    Code:
    show databases;
    Exit from MySQL


    To exit out of MYSQL prompt, type

    Code:
    exit
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

  2. #2
    Join Date
    Nov 2009
    Posts
    76,596

    Default

    Quote Originally Posted by admin View Post
    MySQL comes with command line tool "mysql" that can be used to connect to MySQL and manage database.

    To connect to MySQL, you should know MySQL username and password.

    Connect to MySQL

    Code:
    mysql -u root -p
    It will ask you password.

    Some Basic Commands

    Show all databases.


    Code:
    show databases;
    Exit from MySQL


    To exit out of MYSQL prompt, type

    Code:
    exit


    i got error


  3. #3
    Join Date
    Sep 2003
    Posts
    3,040

    Default

    @sherly

    You don't have to quote everything. Try to say what you doing alone with the error, so others know what you trying to do.

    What you done is

    Code:
    show database;
    on Ubuntu connect prompt. That is not a valid command for ubuntu.

    It is a MYSQL command, that need to be run inside MySQL command prompt.

    If you look few lines above, you will see

    Code:
    mysql>
    That is the MYSQL commend prompt.

    So, first connect to MySQL server, if you read my first post properly, you should know how to connect to MySQL server from command line with command

    Code:
    mysql -u USERNAME_HERE -p
    Now it ask for password.
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

  4. #4
    Join Date
    Nov 2009
    Posts
    76,596

    Default

    I got below result when I run those commands

    Last edited by sherlyk; 01-05-2015 at 06:56 AM.

  5. #5
    Join Date
    Sep 2003
    Posts
    3,040

    Default

    Good, that is fine. We have 3 databases.

    Now install PhpMyAdmin

    http://forums.bizhat.com/showthread....dmin-on-Ubuntu
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

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
  •