mac中无法连接mysql服务器

在mysql启动时

$ mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

在mysql已经关闭时返回错误代码

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

网上很多教程都是

# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --    skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET         Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

但是mac根本没有/etc/init.d目录,求解

查看回复