Forum Moderators: bakedjake

Message Too Old, No Replies

MySQL Issue

I know it's running...but...

         

Argblat

5:14 pm on Dec 21, 2005 (gmt 0)

10+ Year Member



Hi all.

As with my previous post in this Forum...I'm a newbie :::blush::: sewing my wild oats on Fedora 4 (I originally thought I was using RedHat, but now I understand my mistake)

Ok, enough with the Introductions! Fedora 4 comes preinstalled with MySQL...

I went into the command prompt and ran the following


cd /etc/rc.d/init.d/
./mysql start

This worked successfully and I got MySQL up and running.

Here is my problem... I don't know how to access mysql from the command prompt. The next step in the tutorial that I'm reading says to run the following:


cd /usr/bin
mysqladmin -u root -p "password you want to set for root"

But it isn't working!

I also don't know how to get the "mysql>..." in the command prompt (ie..."Start the MySQL Client") so that I can start building tables etc?

I know for certain that MySQL is working becuase I did install MySQL Administrator and Query Browser and BOTH are working fine...BUT I still don't have a password for my root account AND I have no terminal access to MySQL

I would put this in the Database Forum, but I think that it's probably more Linux chops than DB chops. If I'm wrong please let me know, but I do APPRECIATE VERY MUCH ANY HELP

thanks!
Mike

Romeo

5:47 pm on Dec 21, 2005 (gmt 0)

10+ Year Member



But it isn't working!

... could you a bit more spcific?

Normally, it would work:
mysqladmin -u root -p status
Enter password: #*$!xx
Uptime: 48607 Threads: 1 Questions: 38192 Slow queries: 0 Opens: 31 Flush tables: 1 Open tables: 19
The "status" is a mysqladmin command, not the password.

If you want to specify the password on the command line, there is no blank between the -p and the password:
mysqladmin -u root -ppasswd command

To enter the mysql client try this:
mysql -u root -p
and the client will prompt you for the password.

You could also start the client with
mysql -u root -ppasswd
but then again the password gets into the command history file and you probably don't want this.

Regards,
R.

jamie

6:34 pm on Dec 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi mike,

have you set a root password yet?

if not there is a great article on post installation setup and testing on mysql.com [dev.mysql.com...]
this walks you through setting a root password.

if you have already set a root password, then follow romeo's advice above.

if you still can't get in, try just typing

mysql
at the command prompt and posting the results here.

good luck

p.s. one of the best i've read is to create a .my.cnf file in your home directory with just the following lines in it:

[client]
user=root
password=whateveryourrootpasswordis

this means you can then login to the mysql command line just by typing

mysql
.
for security, chmod it to 600:
chmod 600 .my.cnf

this means only you can read it.

wheel

3:53 am on Dec 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'll second the above advice, that you need to login without a password - that's the way Mysql comes when freshly installed, I believe.

You should of course, make sure to set a password once you're in :).

IIRC, you actually login without even specifying the -p option. and maybe without a username as well.

Argblat

2:36 pm on Dec 22, 2005 (gmt 0)

10+ Year Member



Thank you all for your in depth responses.

I open up a fresh terminal window and this is the game I start playing


[root@localhost root]# cd /etc/rc.d/init.d
[root@localhost init.d]# mysql start Why doesn't this work?
bash: mysql: command not found
[root@localhost init.d]# ./mysql start If this does?
Starting MySQL SUCCESS!
[root@localhost init.d]# cd /usr/bin
and is that the same reason that these are not working either?
[root@localhost bin]# /usr/bin/mysql
bash: /usr/bin/mysql: No such file or directory
[root@localhost bin]# cd ..
[root@localhost usr]# mysql
bash: mysql: command not found
[root@localhost usr]# cd ..
[root@localhost /]# mysql
bash: mysql: command not found
[root@localhost /]#

Perhaps it isn't an issue of the command i'm typing but rather where (the current directory) to type in the command?

Please dont' rule anything out becuse I could very easily be missing something simple ... I have nearly no Linux experience

thank you
-Mike

wheel

5:38 pm on Dec 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're all over the map when it comes to this I think.

First, yes the reason your first command didn't work yet the other one did to start mysql has to do with the paths. The init.d isn't in the path environment, so if you just say 'mysql', it looks in the path and doesn't find it. When you add './' in front of it, you tell linux to execute the program from the current directory - then it finds it. (FWIW, in my distro of linux, I run the command 'service mysql start', and the 'service' command is in the path so it finds it and starts mysql from anywhere).

Anyway, so now you've got it started. Now when you type in 'mysql', it's still looking for the mysql command and not finding it. It's not in the path (which is a bit odd) and it's not in /usr/bin/ either from your commands, so it's somewhere else. I guess that varies by linux distribution.

My next step would be the following commands:
>updatedb
>locate mysql

That should tell you where it is located. From there you can add that directory to the path (you'll have to Google for that, it's not hard). Then typing in 'mysql' should work.

All that aside, if it's not in /usr/bin/ and it should be, then you've got other problems. If it's somewhere else deliberately for your distro then the above should get you there.