Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

How to solve Lost connection to MySQL server at 'reading initial communication packet', system error: 0 Question

+0
−0

screenshot of text after rails db:create

screenshot of text

Lost connection to MySQL server at 'reading initial communication packet', syste      m error: 0
Couldn't create 'qpixel_dev' database. Please check your configuration.
rails aborted!
Mysql2::Error::ConnectionError: Lost connection to MySQL server at 'reading init      ial communication packet', system error: 0
/usr/share/rvm/gems/ruby-2.6.6/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `con      nect'
/usr/share/rvm/gems/ruby-2.6.6/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `ini      tialize'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/connect      ion_adapters/mysql2_adapter.rb:22:in `new'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/connect      ion_adapters/mysql2_adapter.rb:22:in `mysql2_connection'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/connect      ion_adapters/abstract/connection_pool.rb:830:in `new_connection'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/connect      ion_adapters/abstract/connection_pool.rb:874:in `checkout_new_connection'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/connect      ion_adapters/abstract/connection_pool.rb:853:in `try_to_checkout_new_connection'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/connect      ion_adapters/abstract/connection_pool.rb:814:in `acquire_connection'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/connect      ion_adapters/abstract/connection_pool.rb:538:in `checkout'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/connect      ion_adapters/abstract/connection_pool.rb:382:in `connection'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/connect      ion_adapters/abstract/connection_pool.rb:1033:in `retrieve_connection'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/connect      ion_handling.rb:118:in `retrieve_connection'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/connect      ion_handling.rb:90:in `connection'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/tasks/m      ysql_database_tasks.rb:6:in `connection'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/tasks/m      ysql_database_tasks.rb:14:in `create'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/tasks/d      atabase_tasks.rb:119:in `create'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/tasks/d      atabase_tasks.rb:139:in `block in create_current'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/tasks/d      atabase_tasks.rb:316:in `block in each_current_configuration'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/tasks/d      atabase_tasks.rb:313:in `each'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/tasks/d      atabase_tasks.rb:313:in `each_current_configuration'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/tasks/d      atabase_tasks.rb:138:in `create_current'
/usr/share/rvm/gems/ruby-2.6.6/gems/activerecord-5.2.6/lib/active_record/railtie      s/databases.rake:29:in `block (2 levels) in <top (required)>'
/usr/share/rvm/gems/ruby-2.6.6/gems/railties-5.2.6/lib/rails/commands/rake/rake_      command.rb:23:in `block in perform'
/usr/share/rvm/gems/ruby-2.6.6/gems/railties-5.2.6/lib/rails/commands/rake/rake_      command.rb:20:in `perform'
/usr/share/rvm/gems/ruby-2.6.6/gems/railties-5.2.6/lib/rails/command.rb:48:in `i      nvoke'
/usr/share/rvm/gems/ruby-2.6.6/gems/railties-5.2.6/lib/rails/commands.rb:18:in `      <top (required)>'
/root/qpixel/bin/rails:9:in `require'
/root/qpixel/bin/rails:9:in `<top (required)>'
/usr/share/rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/client/rails.rb:28:i      n `load'
/usr/share/rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/client/rails.rb:28:i      n `call'
/usr/share/rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/client/command.rb:7:      in `call'
/usr/share/rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/client.rb:30:in `run      '
/usr/share/rvm/gems/ruby-2.6.6/gems/spring-2.1.1/bin/spring:49:in `<top (require      d)>'
/usr/share/rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `lo      ad'
/usr/share/rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<t      op (required)>'
/root/qpixel/bin/spring:13:in `require'
/root/qpixel/bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

2 answers

+3
−0

You forgot to turn on mysql.

sudo systemctl enable mysql

systemctl doesn't work for every distro. If your system doesn't have systemctl then, you have to use service

sudo service mysql enable

Sometimes only enabling mysql service isn't helpful. Then, you have to login to mysql once.

mysql -u root -p

It will request you to enter password. Then, enter your password. Then, you can exit if you want. Then, try creating database again.

rails db:create
History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

2 comment threads

nothing change ! I try everthing. (15 comments)
installation (3 comments)
+0
−0

test

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »