Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X > Mac OS X Server, Xserve, and Networking

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 2, 2010, 03:38 PM   #1
dysan819
macrumors newbie
 
Join Date: Jun 2010
Snow Leopard Server MySQL troubles

I am attempting to use MySQL and cannot seem to authenticate.

I am stuck at

Code:
$ mysql -u root -p mysql
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I have entered the root user's password.
I have reset the root password in the Server Admin.
I have entered every password I could think of.
Is this not a password problem, but something more sinister?

I am trying to set up ATMAIL webmail client and am getting this error:

Code:
Error

Could not connect to Database Server:

SQLSTATE[00000] [1130] Host 'localhost' is not allowed to connect to this MySQL server
Does this relate to the first problem?
I have "Allow network connections" checked.

Thank you in advance!
-Brett
dysan819 is offline   0 Reply With Quote
Old Jul 3, 2010, 04:29 AM   #2
svenwillmann
macrumors member
 
Join Date: May 2008
do you have a password set for your mysql?

if I remember correctly it comes without initially

try to connect using
...$ mysql -u root
svenwillmann is offline   0 Reply With Quote
Old Jul 4, 2010, 06:56 AM   #3
Winni
macrumors 68030
 
Winni's Avatar
 
Join Date: Oct 2008
Location: Germany.
The MySQL root user is NOT the same as the OS X root user. Try what svenwillmann said.
__________________
Coming soon: http://endnacht.de.
Winni is offline   0 Reply With Quote
Old Jul 6, 2010, 09:57 AM   #4
dysan819
Thread Starter
macrumors newbie
 
Join Date: Jun 2010
Yes, I had previously tried 'mysql -u root', which did not work.

Code:
$mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
I have followed various instructions for resetting the root password which appear on both the Apple and MySQL sites. The password resetting usually does not end with any errors, but yields the same result.

I was thinking that the problem was related to the fact that MySQL was preinstalled with OS X Server. The documentation from Apple gives some pretty easy to follow instructions that don't seem to work.

Would reinstalling MySQL work, or do OS X Server services rely on it in its current form?
dysan819 is offline   0 Reply With Quote
Old Jul 6, 2010, 05:22 PM   #5
PilotWoo
macrumors regular
 
Join Date: Jul 2006
I've not tried MySQL on OSX but a default MySQL install on linux has a blank root password after install. The MySQL root password is not the same thing as the root account in the OS.

Try the syntax below. The -P switch is required so that it will prompt for a password (using password: YES). When prompted for the password, press return.

mysql -U root -P
PilotWoo is offline   0 Reply With Quote
Old Jul 7, 2010, 07:50 AM   #6
svenwillmann
macrumors member
 
Join Date: May 2008
reinstall or change MySQL on OS X Server 10.6

A reinstall of MySQL should work and no, OS X Server services do not rely on the current.

Below you will find a step by step guide how to
uninstall current MySQL
reinstall new MySQL
setup the new MySQL
integrate in launchd

If you do not have anything in your current MySQL DB (which I think you donít as you canít access it anyway) you can follow these steps
tried on a os x server 10.6.3

(it is a compilation of excerpts from different machines, so the name of the prompts etc will change in this guide, like sunset:~ svenwillmann$ or xserv or wscsrv ... but not on your side)


Let me know if this solved your problem



1: ###########################

Uninstall MySQL

Fire up terminal and exec following commands

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*

(if entry exists
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-



sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*



2: ###########################
install mysql
download it from http://www.mysql.com/downloads/mysql/
make sure you install the right version eg 64bit or 32bit
"mysql-5.1.46-osx10.6-x86_64.dmg" 64bit
"mysql-5.1.46-osx10.6-x86.dmg" 32bit

otherwise you could end up with an error like
Neither host 'wscsrv.mydomain.local' nor 'localhost' could be looked up with ./bin/resolveip

(if installed from "*.dmg" you will find it in dir /usr/local

3: ###########################
Fire up terminal and make sure the path is there

sunset:~ svenwillmann$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

4: ###########################
Don't rely on your terminal application to set those paths;
instead go ahead and edit/create the file .bash_profile in your home folder (~).

sunset:~ svenwillmann$ touch ~/.bash_profile

inside this file
------------
PATH="/usr/local/bin:/usr/local/sbin:$PATH" # if not already present
PATH="$PATH:/usr/local/mysql/bin"
export PATH=$PATH
------------

5: ###########################
If you don't want to reopen the terminal or switch to another tab, just execute

sunset:~ svenwillmann$ source ~/.bash_profile

6: ###########################
check the path again

sunset:~ svenwillmann$ echo $PATH
/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/mysql/bin

7: ###########################
install default tables etc.

cd to
/usr/local/mysql

and execute
sudo ./scripts/mysql_install_db --user=mysql

eg
------------------------
sunset:mysql svenwillmann$ sudo ./scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h sunset.mydomain.local password 'new-password'

Alternatively you can run:
./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

sunset:mysql svenwillmann$
------------------------

8: ###########################

now go and check if your installation is starting by

sunset:mysql svenwillmann$ sudo ./bin/mysqld_safe

in terminal

9: ###########################
open a new terminal window and do a

sunset:mysql svenwillmann$ mysql -u root

you should now be connected to your mysql db

type
exit at the
mysql>
prompt to log out of mysql

10: ###########################
now shutdown the mysql server by using the following command in terminal

mysqladmin -u root -p shutdown

11: ###########################

now in Server Admin under MySQL service -> settings change your Database location to
/usr/local/mysql

12: ###########################
in order to use Server Admin with your new MySQL installation you have to do following

in terminal exec
sudo launchctl unload /System/Library/LaunchDaemons/org.mysql.mysqld.plist

13: ###########################
now edit the file
/System/Library/LaunchDaemons/org.mysql.mysqld.plist

and change the path to the new MySQL installation in the following lines:


<string>--datadir=/usr/local/mysql-5.1.46-osx10.6-x86</string>
<string>--pid-file=/usr/local/mysql-5.1.46-osx10.6-x86/xserv.local.pid</string>

make sure you only change the part of the folder where mysql is installed to the right version you installed
eg. ...../mysql-5.1.46-osx10.6-x86/..... in my case

save the file (same location /System/Library/LaunchDaemons/org.mysql.mysqld.plist )

14: ###########################
in terminal exec
sudo launchctl load /System/Library/LaunchDaemons/org.mysql.mysqld.plist


15: ###########################
now go and check in Server Admin under MySQL service

you should be ready to go
svenwillmann is offline   0 Reply With Quote
Old Jul 14, 2010, 10:46 AM   #7
mflocco
macrumors newbie
 
Join Date: Jul 2010
Registered just to say thanks for the comprehensive collection of information. This worked perfectly for me.
mflocco is offline   0 Reply With Quote
Old Sep 2, 2010, 12:29 PM   #8
svenwillmann
macrumors member
 
Join Date: May 2008
Quote:
Originally Posted by svenwillmann View Post

Let me know if this solved your problem
dysan819:
I know it is a while...
Would be nice to hear if this solve your problem?
svenwillmann is offline   0 Reply With Quote
Old Dec 30, 2010, 03:39 PM   #9
mustang_dvs
macrumors 6502a
 
mustang_dvs's Avatar
 
Join Date: Feb 2003
Location: Durham, NC
I realize that this thread is a little old, but I wanted to express my thanks.

It saved me quite a lot of heartache and time otherwise spent performing a reinstallation of the entire server OS.
__________________
2.93GHz MacPro 5,1 | 2.6GHz MBP 9,1 | 1.2GHz Cube | 2x 2GHz Mini 2,1 | 160GB iPod | 16GB iPhone 3,3
DVSmith.net | thePhotosmith.com
mustang_dvs is offline   0 Reply With Quote
Old Jan 1, 2011, 04:58 PM   #10
BornAgainMac
macrumors 601
 
BornAgainMac's Avatar
 
Join Date: Feb 2004
Location: Florida Resident
What about just using Server Admin and adding the MySQL service? You can set the MySQL Root Password with this service and the database location.
BornAgainMac is offline   0 Reply With Quote
Old Apr 6, 2011, 03:26 PM   #11
newonmacrumors
macrumors newbie
 
Join Date: Apr 2011
This apply to Snow Leopard Server.
Go to Server Admin, expand your server in the left panel and click on MySQL. Click on the "Stop MySQL" button at the bottom. It will warn you that MySQL clients may lost their connection. Click "Stop Now". Then click on Setting at the right panel. The "Set MySQL Root Password" button should be enabled. Click on it to set the password.
newonmacrumors is offline   0 Reply With Quote
Old Feb 19, 2013, 09:50 PM   #12
prattio
macrumors newbie
 
Join Date: Aug 2012
Thank you for this thread. After upgrading from OSX Server 10.6 to 10.8, the settings for SQL were shot.

I followed this guide, and SQL is running on the server again. Thank you.
prattio is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X > Mac OS X Server, Xserve, and Networking

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Upgrading Leopard to Snow Leopard, will this wipe out my Mac? [EDITED WITH IMAGES] ISJB OS X 1 Oct 5, 2011 07:34 AM
Worth to get back to the Snow Leopard or stay in Lion? Kaelbron OS X 2 Sep 25, 2011 06:48 AM
Setting up mail in Snow Leopard Server jackhdev Mac OS X Server, Xserve, and Networking 0 Jul 30, 2011 08:04 PM
Netboot fail: Client does not boot off netboot server. xfarsightx Mac OS X Server, Xserve, and Networking 0 Jun 29, 2011 10:50 AM
Snow Leopard CD doesn't run sebkom OS X 12 Jan 1, 2011 04:27 AM


All times are GMT -5. The time now is 11:34 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC