Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialogechi1
14,455 PointsActiveRecord Basics, Migrations: rake db:migrate errors out, rake aborted!
When I run rake db:migrate, I receive the following error
rake db:migrate
rake aborted!
Mysql2::Error: Access denied for user 'root'@'localhost' (using password: NO)
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I also receive this error when I run mysql.server start
Starting MySQL .. ERROR! The server quit without updating PID file (/usr/local/var/mysql/name.local.pid).
I've set a password for the root...any suggestions as to why the error might be occurring?
Thank you!
5 Answers
Matt West
14,545 PointsHey!
It looks like the rake error is because the MySQL server isn't running properly. That's what we need to focus on first.
Try running mysql.server start --verbose
to see if you can get any more info about why MySQL won't start.
Post the output here if you're unsure about any messages.
If that doesn't work, try checking the MySQL error log file.
This can generally be found in /usr/local/var/mysql/
, the filename will end with .err
.
Open the file in a text editor and scroll to the bottom to see the most recent items.
Post the most recent section of the log file here if you're unsure of anything.
Keep us posted on how you get on. :)
Matt West
14,545 PointsThanks,
First of all, run mysql.server stop
just to be sure that there's nothing churning away in the background.
Then run ps aux | grep mysql
in your terminal which will confirm that no other mysql server instances are running.
Post the output back here.
Do you use a development environment like MAMP or XAMPP? If you do, they may be running MySQL. Make sure they're closed.
Then there's always the trusty, turn it off and on again method :)
ogechi1
14,455 Pointsmysql.server stop ERROR! MySQL server PID file could not be found!
mysql.server start Starting MySQL . .ERROR! The server quit without updating PID file (/usr/local/var/mysql/aaaMacBookPro.local.pid)
I didn't actually see the PID file in the location stated.
ps aux | grep mysql _mysql 233 0.0 0.1 3112892 2388 ?? S Sat07AM 0:28.18 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/aaaMacBookPro.local.err --pid-file=/usr/local/mysql/data/aaaMacBookPro.local.pid root 123 0.0 0.0 2455896 8 ?? S Sat07AM 0:00.02 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/aaaMacBookPro.local.pid aaa 30552 0.0 0.0 2432784 628 s001 S+ 1:42PM 0:00.01 grep mysql
I did try to turn it off and on again--and made sure the machine was plugged in :P
ogechi1
14,455 PointsI think I haven't gone through the steps to install mysql correctly.
http://stackoverflow.com/questions/4444861/pid-error-on-mysql-server-start
I did the following steps: unset TMPDIR mysql_install_db
mysql_install_db --verbose --user=whoami
--basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
I also updated the my.cnf file to include the basedir and datadir. I think I need to update the configurations file...I will try that, and post the results here.
Thanks!
ogechi1
14,455 PointsI decided to start fresh and did the following uninstall (see steps below): https://coderwall.com/p/os6woq
ps -ax | grep mysql stop and kill any MySQL processes
brew remove mysql
brew cleanup
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*
[restart your computer just to ensure any MySQL processes are killed try to run mysql, it shouldn't work]
Then reinstall:
brew doctor
brew update
brew install mysql
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mysql.server start
run the commands Brew suggests, add MySQL to launchctl so it automatically launches at startup
This seems to have fixed the problem for now...
Thanks!
Matt West
14,545 PointsGood to hear you've got it solved :)
ogechi1
14,455 PointsAlso, using 'mysql -uroot' yields ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
but using 'mysql -u root -p' and entering the password works fine.
ogechi1
14,455 Pointsogechi1
14,455 PointsHi Matt, Thanks for the quick response! :) Here is the first command
mysql.server start --verbose Starting MySQL .. ERROR! The server quit without updating PID file (/usr/local/var/mysql/aaaMacBookPro.local.pid).
The following is pulled from the error log. Earlier, I received a similar message about address already being in use. I close MySQL workbench and that seemed to work. Right now, it is also closed.
2014-09-21 02:33:12 32040 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 2014-09-21 02:33:12 32040 [Note] - '127.0.0.1' resolves to '127.0.0.1'; 2014-09-21 02:33:12 32040 [Note] Server socket created on IP: '127.0.0.1'. 2014-09-21 02:33:12 32040 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use 2014-09-21 02:33:12 32040 [ERROR] Do you already have another mysqld server running on port: 3306 ? 2014-09-21 02:33:12 32040 [ERROR] Aborting
2014-09-21 02:33:12 32040 [Note] Binlog end 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'partition' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_SYS_FIELDS' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_SYS_INDEXES' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_SYS_TABLES' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_FT_CONFIG' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_FT_DELETED' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_METRICS' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_CMPMEM' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_CMP_RESET' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_CMP' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_LOCK_WAITS' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_LOCKS' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'INNODB_TRX' 2014-09-21 02:33:12 32040 [Note] Shutting down plugin 'InnoDB' 2014-09-21 02:33:12 32040 [Note] InnoDB: FTS optimize thread exiting. 2014-09-21 02:33:12 32040 [Note] InnoDB: Starting shutdown... 2014-09-21 02:33:13 32040 [Note] InnoDB: Shutdown completed; log sequence number 10867888 2014-09-21 02:33:13 32040 [Note] Shutting down plugin 'BLACKHOLE' 2014-09-21 02:33:13 32040 [Note] Shutting down plugin 'ARCHIVE' 2014-09-21 02:33:13 32040 [Note] Shutting down plugin 'MRG_MYISAM' 2014-09-21 02:33:13 32040 [Note] Shutting down plugin 'MyISAM' 2014-09-21 02:33:13 32040 [Note] Shutting down plugin 'MEMORY' 2014-09-21 02:33:13 32040 [Note] Shutting down plugin 'CSV' 2014-09-21 02:33:13 32040 [Note] Shutting down plugin 'sha256_password' 2014-09-21 02:33:13 32040 [Note] Shutting down plugin 'mysql_old_password' 2014-09-21 02:33:13 32040 [Note] Shutting down plugin 'mysql_native_password' 2014-09-21 02:33:13 32040 [Note] Shutting down plugin 'binlog' 2014-09-21 02:33:13 32040 [Note] /usr/local/Cellar/mysql/5.6.20_1/bin/mysqld: Shutdown complete