I have been trying to create a new rails app using mysql and both my windows and linux (ubuntu 22.04) machines are refusing to work. Linux just constantly gives me an access denied regardless of the privileges granted to any user, and windows keeps saying 'failed to init transaction (unable to lock databse)
i have no clue what to do and have spent literally 5 hours straight just running through google and have found no answers.
here is the full error prompt:
C:\wamp64\www\railsApp>gem install mysql2
Using rubygems directory: C:/Users/johna/.local/share/gem/ruby/3.2.0
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-ucrt-x86_64-libmariadbclient
error: failed to init transaction (unable to lock database)
error: could not lock database: Permission denied
pacman failed with the following output:
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: C:/Users/johna/.local/share/gem/ruby/3.2.0/gems/mysql2-0.5.6/ext/mysql2
C:/Ruby32-x64/bin/ruby.exe extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_gc_mark_movable()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enc_interned_str() in ruby.h... yes
*** 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 may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby32-x64/bin/$(RUBY_BASE_NAME)
--with-openssl-dir
--without-openssl-dir
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
--without-mysql-config
--with-mysqlclient-dir
--without-mysqlclient-dir
--with-mysqlclient-include
--without-mysqlclient-include=${mysqlclient-dir}/include
--with-mysqlclient-lib
--without-mysqlclient-lib=${mysqlclient-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
C:/Ruby32-x64/lib/ruby/3.2.0/mkmf.rb:1083:in `block in find_library': undefined method `split' for nil:NilClass (NoMethodError)
paths = paths.flat_map {|path| path.split(File::PATH_SEPARATOR)}
^^^^^^
from C:/Ruby32-x64/lib/ruby/3.2.0/mkmf.rb:1083:in `each'
from C:/Ruby32-x64/lib/ruby/3.2.0/mkmf.rb:1083:in `flat_map'
from C:/Ruby32-x64/lib/ruby/3.2.0/mkmf.rb:1083:in `find_library'
from extconf.rb:131:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/Users/johna/.local/share/gem/ruby/3.2.0/extensions/x64-mingw-ucrt/3.2.0/mysql2-0.5.6/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/Users/johna/.local/share/gem/ruby/3.2.0/gems/mysql2-0.5.6 for inspection.
Results logged to C:/Users/johna/.local/share/gem/ruby/3.2.0/extensions/x64-mingw-ucrt/3.2.0/mysql2-0.5.6/gem_make.out
i looked at the error log "mkmf.log" but it makes zero sense to me. i will post it if i need to.
i have tried to run gem install mysql2 and even used differnt options like including the directory where mysql is installed, and downloaded the mysql-connector and using that directory as well and still receive the same option.
rails works totally fine if i run 'rails new myapp' but as soon as i add '-d=mysql' (or even postgresql) it fails horrendously.