Mysql::Error: Lost connection to MySQL server during query:

解决这个问题的步骤是:
1.下载 mysql/ruby 2.7.1


2解压其中的mysql.so到%RUBYARCHDIR%目录下(例如:C:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt)

3.MySQL/Ruby needs a DLL dependency satisfied in order to run. You can do this by either:

    ------(Recommended) Including the MySQL bindir in your path (e.g. C:\Program Files\MySQL\MySQL Server 5.0\bin).


    ------Copying libmysql.dll from your MySQL bindir or source package to your Ruby bindir (e.g. C:\ruby\bin).


引用
Instant Rails users: You will find that the libmysql.dll from the included PHP distribution won’t work. Instead, grab a libmysql.dll from a real MySQL distribution. InstantRails 1.3a comes with MySQL 4.1.9, which you can download here



4.To verify, try to run the following code:

require 'mysql'
puts Mysql::VERSION


If it outputs 20700, then you’re all set up

你可能感兴趣的:(mysql,PHP,C#,Ruby,Rails)