command prompt/console

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nitinpatel1117
    New Member
    • Jun 2007
    • 111

    command prompt/console

    Hi, i've never used linux before, so what i have is a really basic question

    Basically i've been qiven a linux machine (more specifically Red Hat linux).
    This machine has everything installed, i.e. MySQL, apache and PHP.

    I already know that apache (httpd) and mysql (mysqld) are running as a service, now what i'm trying to do is to start the MySQL window, i.e. the window that i can type something along the lines of "select * from table1;"

    in windows i just get a dos type window to enter the sql queries into, after apache is started.

    But in linux, i can't find the console or program that i need to use to get this thing to start.

    Aplogies if this is really basic, but i just got given this linux. and have been looking searching all over net for answers.

    any help would be of great help
  • prn
    Recognized Expert Contributor
    • Apr 2007
    • 254

    #2
    I don't claim to be an expert on mysql, but it looks to me like http://www.yolinux.com/TUTORIALS/LinuxTutorialMy SQL.html (the first google hit for "linux mysql console") seems to have a useful basic intro for how to do essentially what you are asking. If this does not help, let us know what part doesn't work.

    Best Regards,
    Paul

    Comment

    • nitinpatel1117
      New Member
      • Jun 2007
      • 111

      #3
      Hi prn,

      thanks for the reply, though it's not quite what i'm after.

      Basically, i'm trying to find the linux console, and more importantly the mysql console.

      Let me explain:
      the text below is a linux command
      $ man -k files

      where do i type these commands into, i.e. how do i get to the program/console that allows me to type these commands
      for example, in windows, to get to dos I would go to start --> programs --> accessories --> command prompt
      to get to the windows console.

      also to start the MySQL database, i believe that i need to type:
      /etc/rc.d/init.d/mysqld start
      but, again, were do i type this into.

      I know this may sound like a simple question, maybe i'm not phrasing it properly. but i've looked all over the linux machine for this console or program. the fact that i don't know the name of the actual thing that i'm loooking for makes the whole thing more harder.

      Comment

      • sicarie
        Recognized Expert Specialist
        • Nov 2006
        • 4677

        #4
        I'm assuming (with Red Hat) that you're using KDE. In this case, I believe it is called a "Terminal" or "Console" and looks like a computer monitor/screen. I'm not entirely sure which menu this is in, but if you go to the main menu, I would guess it's in System or something around there.

        There's another option as well, but last time I used it, it broke KDE, so I'm not sure I want to recommend that yet (of course, the last time I used it was a few years ago).

        Comment

        • Motoma
          Recognized Expert Specialist
          • Jan 2007
          • 3236

          #5
          You could try and find the run command, it is usually placed nicely in one of the menus.

          Some of the different consoles are:
          konsole
          gnome-terminal
          term
          xterm

          Once you have gotten one of those, the mysql command line can be brought up via 'mysql'

          Comment

          • nitinpatel1117
            New Member
            • Jun 2007
            • 111

            #6
            sicarie/Motoma

            thanks guys, this was exactly what i was after.

            it was called terminal.
            and also the 'run program' bit worked as well


            but, still trying to get the mysql console to appear, doesn't seem to like the command 'mysql' in the run programs bit.

            Comment

            • sicarie
              Recognized Expert Specialist
              • Nov 2006
              • 4677

              #7
              Originally posted by nitinpatel1117
              sicarie/Motoma

              thanks guys, this was exactly what i was after.

              it was called terminal.
              and also the 'run program' bit worked as well


              but, still trying to get the mysql console to appear, doesn't seem to like the command 'mysql' in the run programs bit.
              Does it give you an error when you try 'mysql'? Which user are you when you are attempting to log in?

              (And now that you have console access, did you look at the yolinux tutorial that prn posted?)

              Comment

              • Motoma
                Recognized Expert Specialist
                • Jan 2007
                • 3236

                #8
                Originally posted by nitinpatel1117
                sicarie/Motoma

                thanks guys, this was exactly what i was after.

                it was called terminal.
                and also the 'run program' bit worked as well


                but, still trying to get the mysql console to appear, doesn't seem to like the command 'mysql' in the run programs bit.
                Did you try calling it from inside the terminal?

                It should look something like this:

                [username@hostna me ~]# mysql

                (you will only type mysql, the rest is your prompt)

                What message do you get?

                Comment

                • devikacs
                  New Member
                  • Jun 2007
                  • 96

                  #9
                  maybe the path to your mysql is not set. Please check.
                  If typing mysql in your terminal doesnt work, search for mysql.
                  Also check if the service is running.
                  /sbin/service mysqld start -to start mysqld

                  Originally posted by Motoma
                  Did you try calling it from inside the terminal?

                  It should look something like this:

                  [username@hostna me ~]# mysql

                  (you will only type mysql, the rest is your prompt)

                  What message do you get?

                  Comment

                  • nitinpatel1117
                    New Member
                    • Jun 2007
                    • 111

                    #10
                    when i run 'mysql' through the run program, nothing happens i.e. there are no errors, and nothing else appears on the screen, it just seems to do nothing.

                    however when i run 'mysql' through the terminal: i get the following error:

                    ERROR 1045: Access denied for user: 'root@localhost ' (Using password: NO)

                    I guessed this had something to do with the password not being set.

                    therefore, from the link that prn posted, i tried resetting the password using

                    mysqladmin -u root password xxxxxx

                    but this brings up an error:
                    mysqladmin: connect to server at 'localhost' failed
                    error: Access denied for user: 'root@localhost ' (Using password: NO)


                    but then i tried to create a database anyway, using the line
                    mysqladmin -h localhost -u root -pxxxxxx create cw

                    and this gives the error:
                    mysqladmin: connect to server at 'localhost' failed
                    error: Access denied for user: 'root@localhost ' (Using password: YES)

                    same as before but this time the Using password is YES rather than NO. i have no idea what this means, but i assume that it means that i've attempted a password

                    also when i try to connect to the database using:
                    mysql -h localhost -u root -pxxxxxx
                    i get:
                    ERROR 1045: Access denied for user: 'root@localhost ' (Using password: YES)


                    I'm not sure, but i think its becuase i may be using the wrong password to connect, in which case i will probably have to reinstall MySQL to rest the password.


                    the mysqld service is definatly running, and also i made sure it was by typing
                    /sbin/service mysqld start (system reponded my saying starting MySQL)
                    as suggested by devikacs

                    Comment

                    • Motoma
                      Recognized Expert Specialist
                      • Jan 2007
                      • 3236

                      #11
                      What you will want to do is this:

                      # mysqladmin -u root password xxxxxxxx
                      # mysql -p

                      You will then be prompted for your password.

                      Comment

                      • nitinpatel1117
                        New Member
                        • Jun 2007
                        • 111

                        #12
                        Hi Motoma,

                        I have tried that,
                        typing
                        # mysqladmin -u root password xxxxxxxx

                        gives me the error:

                        mysqladmin: connect to server at 'localhost' failed
                        error: 'Access denied for user: 'root@localhost ' (Using password: NO)'

                        any idea on the possible cause of this, e.g. whether it is a password problem, a user access/permission problem or just that MySQL is incorrectly setup.

                        Comment

                        • Motoma
                          Recognized Expert Specialist
                          • Jan 2007
                          • 3236

                          #13
                          Originally posted by nitinpatel1117
                          Hi Motoma,

                          I have tried that,
                          typing
                          # mysqladmin -u root password xxxxxxxx

                          gives me the error:

                          mysqladmin: connect to server at 'localhost' failed
                          error: 'Access denied for user: 'root@localhost ' (Using password: NO)'

                          any idea on the possible cause of this, e.g. whether it is a password problem, a user access/permission problem or just that MySQL is incorrectly setup.
                          Oh, mysqladmin needs the password. Try adding -p to the argument list.

                          Comment

                          • nitinpatel1117
                            New Member
                            • Jun 2007
                            • 111

                            #14
                            Hi,

                            thanks for your help guys.

                            i managed to get into mysql console

                            the problem was that the user had been changed, and was not the default 'root' user.

                            in the end, after lots of combinations, the line below got me in.

                            #mysql -u xxxxxx -pxxxxxx

                            thanks again to those that replied to this post, in was very helpful

                            Comment

                            • Motoma
                              Recognized Expert Specialist
                              • Jan 2007
                              • 3236

                              #15
                              Glad you have gotten everything figured out. Come back anytime you have a problem.

                              Comment

                              Working...