Forum Moderators: travelin cat

Message Too Old, No Replies

Finding out MySQL username/passowrd

         

fwordboy

3:08 pm on Jun 16, 2005 (gmt 0)

10+ Year Member



I've just inherited a Mac at my ne wplace of work with MySQL, Apache 2 and PHP preinstalled.

Great, or at least it would be if I could connect to MySQL through phpMyAdmin or any other means as I don't know the password for the root account. I am new to macs so I don't know where to find this out. In Windows I could just check the my.ini file and all would be fine but, I can't find the mac equivalent. Searching the net the answer has so far proved fruitless.

any ideas?

coopster

3:30 pm on Jun 16, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You could search the scripts directories for connection scripts to see if you can locate it in there. If not, you can always Reset the Root Password [dev.mysql.com].

lZakl

3:51 pm on Jun 16, 2005 (gmt 0)

10+ Year Member



First... try this:

[sunsite.mff.cuni.cz...]

To get to your command line, just open Macintosh HD --> Applications --> Utilities --> Terminal

Let us know if this works

-- Zak

<Added>
coopster, you beat me to it!
</added>

fwordboy

5:41 pm on Jun 16, 2005 (gmt 0)

10+ Year Member



coopster:
I can't follow your advice as the all the connection scripts give the username and password for the remote database and not on my local machine; I would have thought they'd be identical alas, they're not.

IZakI:
I'll give this a try tomorrow when I'm back at work.

lZakl

7:25 pm on Jun 16, 2005 (gmt 0)

10+ Year Member



Just curious ... did you try it with "root" as username and nothing as the password?

-- Zak

fwordboy

8:57 am on Jun 17, 2005 (gmt 0)

10+ Year Member



Ok, now I'm really confused. Accessing phpMyAdmin with the user name of root and any password/no password gives the following error

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server.

MySQL said: Documentation
#1045 - Access denied for user: 'root@localhost' (Using password: NO)

--

but if I change config.inc.php so the username is for example 'xyz' I can get to view the proper screen for phpMyAdmin and not the error splash screen. Witht he messages

MySQL 4.0.20-standard running on localhost as xyz@localhost

Create new database Create new database: Documentation
No Privileges

-- Could this be that although MySQL is on the machine all databases have been deleted including the user table?

fwordboy

11:15 am on Jun 17, 2005 (gmt 0)

10+ Year Member



i have just noticed that the data folder in mysql is restricted,; is this always the case with mysql on the mac or is this a problem specific to my machine?

lZakl

6:19 pm on Jun 17, 2005 (gmt 0)

10+ Year Member



It may behoove you to run Disk Utility and Repair Permissions. Also make sure you are logged into the machine with 'administrative privileges'. Mac is finicky about letting only 'authorized users' view files. (which is a very good thing btw)

IMO If that doesn't work, it may be easiest to start with a fresh install of MySQL.

To uninstall I use entropy.ch's script, found Here [entropy.ch]

On that same site you will find pretty detailed explainations of the install process, removing old versions of MySQL and what is required.

Sorry to not be of much help here, but a fresh MySQL install 'should' only take 20 minutes. Of course if you can't access MySQL to do a data dump, you will lose any databases if you had any.

-- Zak

fwordboy

8:02 am on Jun 20, 2005 (gmt 0)

10+ Year Member



lZakl:

the databases can be saved from the live site so pain-in-ass it may be, but it isn't the end of the world.

I will be enlisting the help of the Mac expert when he comes round in the next day or so.

Thanks for your help everyone;

BjarneDM

5:54 pm on Jun 21, 2005 (gmt 0)

10+ Year Member



1) logging in as xyz
This just mean that the permission has been set so that everyone can log in and access the public databases. But apparently there are none of that kind. The other databases haven't been deleted - they are just invisible to the xyz user

2) mysql folder:
This folder has to be at least writeable by the mysql user/group. Thus, it's very common for this folder not to be accessible by anyone else but mysql. You can change this if you wish to allow both you and mysql to access the folder.

The best option for you is to follow the instructions in the third part of the problem solving as described on the dev.mysql.com page previously referenced.

Now,!how! does mysql start on your system? Do you have a MySQL in /Library/StartupItems or /System/Library/StartupItems? I know of at least three different distributions of MySQL so we do need to know which one you've got installed in order to help you further.

Do you have a MySQL PreferencePane?

To solve your problems you'll have to delve into the arcane art of using Terminal. phpmyadmin is completely unable and unsuitable to solve this problem.

Further questions:
1) do you have any experience with Terminal?
2) do you have BBEdit installed?
3) what's the location of your mysql data folder?
4) in Terminal, what result do you get from this command : sudo find / -name 'mysqld_safe'
5) in Terminal, what result do you get from this command : echo $PATH

fwordboy

8:52 am on Jun 22, 2005 (gmt 0)

10+ Year Member



1) no
2) yes
3) /usr/local/mysql/data/
4) find: /-name: No such file or directory
find: mysqld_safe: No such file or directory
5) /bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin

the mac guy is coming in today to have a look at it; with the most likely outcome being a complete format and reinstalling of OS X on my system.

I think this started out as a password issue but, due to my inexperience with Macs and my explorative nature, the problem has gotten increasingly worse.

fwordboy

11:06 am on Jun 23, 2005 (gmt 0)

10+ Year Member



MySQL has now been deleted and reinstalled but sadly I am still failing to connect to it due to password problems.

I set the root password to blue and then set up the relevant username/password/hostname combo in phpmyadmin's config.inc.php file but, i was still getting errors when connecting.

When i tried to change the root password from blue to red I was told that the blue password was incorrect so I tried blue' (with an apostrophe) and it worked to change the password . p.s. this isn't ecause I have copied and pasted the password complete with apostrophe. This little apostrophe is coming from nowhere.

In phpmyadmin if I use the password followed by the apostrophe I get nowhere either. Could my machine be chnaging my password as soon as I create it?

BjarneDM

6:44 pm on Jun 23, 2005 (gmt 0)

10+ Year Member



Quote:
Could my machine be chnaging my password as soon as I create it?

No. You've done something wrong at some time during the re-install of MySQL when specifying the root password.

lZakl

11:30 pm on Jun 23, 2005 (gmt 0)

10+ Year Member



What is the error when trying to connect? Could it be that you are trying to use MYSQL's new authentication? You could try setting the password to 'old password' authentication ... Try this ...

mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('your_password')

-> WHERE Host = 'your_host' AND User = 'user_name';

mysql> FLUSH PRIVILEGES;

-- Zak

fwordboy

8:44 am on Jun 28, 2005 (gmt 0)

10+ Year Member



my error is through phpmyadmin so it simply tells me to check my hostname, username and/or password to make sure they are correct.

When I reinstalled MySQL i set the root password by copying the password from a text file which seemed to work fine and the password "dots showed up" in the password field and when I clicked set password it all worked fine. I have since learnt that in OS X you cannot copy and paste passwords so does that mean that I have a password made up of those "little password dots"?

lZakl

10:28 pm on Jun 28, 2005 (gmt 0)

10+ Year Member



lol

Yes you very well may! Depending on what program you were using to copy and paste, they can just be astrisks (Shift + 8) or Bullets (Option + 8). Or ... you may never know ...

-- Zak

fwordboy

9:03 am on Jun 29, 2005 (gmt 0)

10+ Year Member



dang! all dots and asterisks don't seem to have worked!

fwordboy

9:47 am on Jun 29, 2005 (gmt 0)

10+ Year Member



It works it works it works!

I removed the old package and reinstalled, and this time I configured the root password via terminal and all is well.

God I am so happy I could puke!

Thnaks to everyone for all their suggestions and help. Much appreciated.