I am running a rails app with mysql. My computer shut down in an unorthodox way and now when I am trying to run rails s
I get Access denied for user 'root'@'localhost' (using password: NO)
My database.yml file looks like :
default: &default
adapter: mysql2
encoding: utf8
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
password:
socket: /tmp/mysql.sock
development:
<<: *default
database: or_deco__site_development
when Im trying to launch mysql server as root with mysql start
I get this trace :
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61 "Connection refused")
when I try mysqld --user=mysql as why suggested on mysql website I get this trace:
2017-06-07 18:10:54 140735296021248 [Note] mysqld (mysqld 10.1.19-MariaDB) starting as process 1462 ...
2017-06-07 18:10:54 140735296021248 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2017-06-07 18:10:54 140735296021248 [Warning] One can only use the --user switch if running as root
2017-06-07 18:10:54 140735296021248 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-06-07 18:10:54 140735296021248 [Note] InnoDB: The InnoDB memory heap is disabled
2017-06-07 18:10:54 140735296021248 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-06-07 18:10:54 140735296021248 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-06-07 18:10:54 140735296021248 [Note] InnoDB: Compressed tables use zlib 1.2.5
2017-06-07 18:10:54 140735296021248 [Note] InnoDB: Using SSE crc32 instructions
2017-06-07 18:10:54 140735296021248 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-06-07 18:10:54 140735296021248 [Note] InnoDB: Completed initialization of buffer pool
2017-06-07 18:10:55 140735296021248 [Note] InnoDB: Highest supported file format is Barracuda.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'mysql/gtid_slave_pos'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"mysql"."gtid_slave_pos"', ignored.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'mysql/innodb_index_stats'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"mysql"."innodb_index_stats"', ignored.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'mysql/innodb_table_stats'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"mysql"."innodb_table_stats"', ignored.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/active_admin_comments'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"or_deco__site_development"."active_admin_comments"', ignored.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/administrators'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"or_deco__site_development"."administrators"', ignored.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/ar_internal_metadata'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"or_deco__site_development"."ar_internal_metadata"', ignored.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/carousels'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"or_deco__site_development"."carousels"', ignored.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/contacts'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"or_deco__site_development"."contacts"', ignored.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/headers'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"or_deco__site_development"."headers"', ignored.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/images'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"or_deco__site_development"."images"', ignored.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/schema_migrations'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"or_deco__site_development"."schema_migrations"', ignored.
2017-06-07 18:10:55 7fff7d53a300 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/sections'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [ERROR] InnoDB: Tablespace open failed for '"or_deco__site_development"."sections"', ignored.
2017-06-07 18:10:55 140735296021248 [Note] InnoDB: 128 rollback segment(s) are active.
2017-06-07 18:10:55 140735296021248 [Note] InnoDB: Waiting for purge to start
2017-06-07 18:10:55 4959924224 [ERROR] InnoDB: Failed to find tablespace for table '"mysql"."innodb_table_stats"' in the cache. Attempting to load the tablespace with space id 1.
2017-06-07 18:10:55 127a27000 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 4959924224 [ERROR] InnoDB: Could not find a valid tablespace file for 'mysql/innodb_table_stats'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 4959924224 [ERROR] InnoDB: Failed to find tablespace for table '"mysql"."innodb_index_stats"' in the cache. Attempting to load the tablespace with space id 2.
2017-06-07 18:10:55 127a27000 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 4959924224 [ERROR] InnoDB: Could not find a valid tablespace file for 'mysql/innodb_index_stats'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 4959924224 [ERROR] InnoDB: Failed to find tablespace for table '"or_deco__site_development"."images"' in the cache. Attempting to load the tablespace with space id 27.
2017-06-07 18:10:55 127a27000 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 4959924224 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/images'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 4959924224 [ERROR] InnoDB: Failed to find tablespace for table '"or_deco__site_development"."carousels"' in the cache. Attempting to load the tablespace with space id 13.
2017-06-07 18:10:55 127a27000 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 4959924224 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/carousels'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 4959924224 [ERROR] InnoDB: Failed to find tablespace for table '"or_deco__site_development"."schema_migrations"' in the cache. Attempting to load the tablespace with space id 4.
2017-06-07 18:10:55 127a27000 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2017-06-07 18:10:55 4959924224 [ERROR] InnoDB: Could not find a valid tablespace file for 'or_deco__site_development/schema_migrations'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-06-07 18:10:55 140735296021248 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.32-79.0 started; log sequence number 2135725
2017-06-07 18:10:55 4961533952 [Note] InnoDB: Dumping buffer pool(s) not yet started
2017-06-07 18:10:55 140735296021248 [Note] Plugin 'FEEDBACK' is disabled.
2017-06-07 18:10:55 140735296021248 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2017-06-07 18:10:55 140735296021248 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
2017-06-07 18:10:55 140735296021248 [Note] Server socket created on IP: '::'.
2017-06-07 18:10:55 140735296021248 [ERROR] Can't start server : Bind on unix socket: Address already in use
2017-06-07 18:10:55 140735296021248 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
2017-06-07 18:10:55 140735296021248 [ERROR] Aborting
What should I do to fix this ?
EDIT
After looking around, I tried numerous things:
1) I tried to stop all mysql running processes I still have one process that I cant kill because the pid is constantly changing
ps aux |grep mysql
davidgeismar 19342 0.0 0.0 2432772 532 s000 R+ 7:00PM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn mysql
2) I also tried creating the mysql.sock file in /tmp as my original error message was : ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61 "Connection refused")
without more success
3) I tried desinstalling and reinstalling mysql via homebrew several times
4) I also checked the rights on cd /usr/local/Cellar/mysql/5.7.18_1/
and Im getting this :
-rw-r--r-- 1 _mysql _mysql 17987 Mar 18 08:56 COPYING
-rw-r--r-- 1 _mysql _mysql 1234 Jun 9 18:27 INSTALL_RECEIPT.json
-rw-r--r-- 1 _mysql _mysql 2478 Mar 18 08:56 README
drwxr-xr-x 42 _mysql _mysql 1428 Jun 9 18:27 bin
drwxr-xr-x 2 _mysql _mysql 68 Jun 9 18:51 data
-rw-r--r-- 1 _mysql _mysql 543 Jun 9 18:27 homebrew.mxcl.mysql.plist
drwxr-xr-x 3 _mysql _mysql 102 Mar 18 08:56 include
drwxr-xr-x 9 _mysql _mysql 306 Mar 18 08:56 lib
drwxr-xr-x 3 _mysql _mysql 102 Mar 18 08:56 scripts
drwxr-xr-x 6 _mysql _mysql 204 Mar 18 08:56 share
drwxr-xr-x 6 _mysql _mysql 204 Jun 9 18:27 support-files
everything seems to be owned by mysql which is supposed to be the correct permissions from what I read...
I really dont know what to do next.
Access denied for user 'root'@'localhost' (using password: NO)
You should supply the password of the DB in the database.yml
file that is associated with the username root
default: &default
adapter: mysql2
encoding: utf8
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
password: Your_DB_Password_Here
socket: /tmp/mysql.sock
development:
<<: *default
database: or_deco__site_development
Update:
You should set password to a root user and use that in database.yml
. Try the below to set the password.
$ mysql -u root -p
mysql> SET PASSWORD FOR 'root'@'localhost' = 'your_password_here'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.