Use MariaDB instead of MySQL in my Rails project

后端 未结 6 1314
春和景丽
春和景丽 2021-02-05 07:25

How can I use MariaDB instead of MySQL in my Rails project?

When I try to install mysql2 gem it returns error,because mysqlclient was not found.

Here some soluti

6条回答
  •  情书的邮戳
    2021-02-05 07:51

    Probably you are getting error related with mariadb_config. Something like

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    
        /home/dev/.rbenv/versions/2.1.5/bin/ruby extconf.rb --with-mysql-config=/usr/bin/mariadb_config
    checking for ruby/thread.h... yes
    checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
    checking for rb_thread_blocking_region()... yes
    checking for rb_wait_for_single_fd()... yes
    checking for rb_hash_dup()... yes
    checking for rb_intern3()... yes
    -----
    Cannot find mysql_config at /usr/bin/mariadb_config
    -----
    *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of necessary
    libraries and/or headers.  Check the mkmf.log file for more details. 
    

    You just need to go to /usr/bin directory and run this command

    sudo ln -nfs mysql_config mariadb_config

    This will solve your problem.

提交回复
热议问题