Closed plan889 closed 8 years ago
Comment out the "socket: /var/run/mysqld/mysqld.sock" line in your database.yml file
That issue is solved.
Now I am facing another issue when i tried to run .. please help
rake db:migrate == CreateProjects: migrating ================================================= -- create_table(:projects) rake aborted! StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead: CREATE TABLE projects
(id
int(11) DEFAULT NULL auto_increment PRIMARY KEY, name
varchar(255), code
varchar(255), description
text, is_deleted
tinyint(1) DEFAULT 0, created_at
datetime, updated_at
datetime) ENGINE=InnoDB
/Library/Ruby/Gems/2.0.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:80:in _query' /Library/Ruby/Gems/2.0.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:80:in
block in query'
/Library/Ruby/Gems/2.0.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:79:in handle_interrupt' /Library/Ruby/Gems/2.0.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:79:in
query'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:287:in block in execute' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:435:in
block in log'
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.3/lib/active_support/notifications/instrumenter.rb:20:in instrument' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:430:in
log'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:287:in execute' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/mysql2_adapter.rb:222:in
execute'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:190:in create_table' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:471:in
create_table'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:625:in block in method_missing' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:597:in
block in say_with_time'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:597:in say_with_time' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:617:in
method_missing'
/Applications/XAMPP/xamppfiles/htdocs/fluxday/db/migrate/20140313044626_create_projects.rb:3:in change' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:571:in
exec_migration'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:555:in block (2 levels) in migrate' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:554:in
block in migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in with_connection' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:553:in
migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:709:in migrate' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:959:in
block in execute_migration_in_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:1007:in ddl_transaction' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:958:in
execute_migration_in_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:920:in block in migrate' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:916:in
each'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:916:in migrate' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:764:in
up'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/migration.rb:742:in migrate' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.3/lib/active_record/railties/databases.rake:42:in
block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Thank You
Duplicate of #5
when i run this command.
rake db:create
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "database"=>"tracker_development", "pool"=>5, "username"=>"root", "password"=>"foradian", "socket"=>"/var/run/mysqld/mysqld.sock"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}
I have created tracker_development, tracker_test, tracker_production with utf8_unicode_ci and I have a root user with no password
my database.yml looks like this
MySQL. Versions 4.1 and 5.0 are recommended.
Install the MYSQL driver
gem install mysql2
Ensure the MySQL gem is defined in your Gemfile
gem 'mysql2'
And be sure to use new-style password hashing:
http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development: adapter: mysql2 encoding: utf8 database: tracker_development pool: 5 username: root password: socket: /var/run/mysqld/mysqld.sock
Warning: The database defined as "test" will be erased and
re-generated from your development database when you run "rake".
Do not set this db to the same as development or production.
test: adapter: mysql2 encoding: utf8 database: tracker_test pool: 5 username: root password: socket: /var/run/mysqld/mysqld.sock
production: adapter: mysql2 encoding: utf8 database: tracker_production pool: 5 username: root password: socket: /var/run/mysqld/mysqld.sock
I am new to ruby.. let me know if I am doing anything wrong.
Thank You