I got into trouble while creating the original application, and I uninstalled MySQL once and reinstalled it. After execution, when I ran rails s to connect to the local host on the terminal, the following error occurred.
What I tried
$rails s dlopen (/Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle, 9): Library not loaded:/usr/local/opt/[email protected]/lib/libmysqlclient.18.dylib (LoadError) Referenced from: /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle Reason: image not found-/Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle
① Check with brew info mysql
$brew info mysql mysql: stable 8.0.21 (bottled) Open source relational database management system https://dev.mysql.com/doc/refman/8.0/en/ Conflicts with: mariadb (because mysql, mariadb, and percona install the same binaries) percona-server (because mysql, mariadb, and percona install the same binaries) /usr/local/Cellar/mysql/8.0.21_1 (290 files, 293.7MB) * Poured from bottle on 2020-09-14 at 16:11:54 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/mysql.rb License: GPL-2.0 ==>Dependencies Build: cmake ✘ Required: openssl @ 1.1 ✔, protobuf ✔ ==>Caveats We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation MySQL is configured to only allow connections from localhost by default To connect run: mysql -uroot To have launchd start mysql now and restart at login: brew services start mysql Or, if you don't want/need a background service you can just run: mysql.server start ==>Analytics install: 70,150 (30 days), 200,477 (90 days), 807,629 (365 days) install-on-request: 67,942 (30 days), 194,554 (90 days), 774,283 (365 days) build-error: 0 (30 days)
② Move the symbolic link referring to the following article
By unifying the MySQL version to 5.6, Library not loaded: libmysqlclient.18.dylib (LoadError) when running rails s in the terminal is resolved.
However, when I started MySQL, the following error occurred.
$mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/tmp/mysql.sock' (2)
I have reinstalled MysQL, but for some reason my password has to be authenticated, or I don't seem to have root privileges.
Answer # 1
This MySQL is 5.6
Library not loaded: /usr/local/opt/[email protected]/lib
On the other hand, this MySQL is 8.0
$brew info mysql
mysql: stable 8.0.21
- python 3x - library cannot be installed due to ssl error in python pip
- error with net start mysql 57
- [flask + sqlalchemy] i want to use mysql, but i get a sqlite error
- [xcode] "library not found for -l iphone-lib" error occurs when building
- error when starting service in mysql
- mysql - mariadb suddenly got an error and couldn't connect to the local server
- ruby - causes of mysql error when starting unicorn on ec2
- python 3x - an error occurs in the library for python3 tkinter drag and drop
- i read mamp mysql with rails 5 and get an error
- error about mysql when building environment with docker
- about permission error when backing up with mysql
- c # - mstest library file name is too long and build error
- java - i get an error when connecting to mysql
- i get an error trying to connect to the root of mysql
- mysql - please tell us about the error statement for rails db: create!
- about error connecting nodejs application and mysql
- ruby - mysql error after auto deploy
- error message from mysql when opening laravel app
- mysql - sqlstate[hy000]: general error: 1366 incorrect string value
- ruby - when posting an image, an error occurs where the image is not defined
- mysql - groups with 0 group participants are also displayed in the list
- mysql - bundle install will not be executed
- ruby - i want to retrieve only the values of a specific column from the rails array
- what to do if you can't start mysql
- ruby - can't db: migrate after deploying to heroku
- unable to boot with mysql error number 28 means'no space left on device'!
- mysql - can't db: migrate to heroku
- [rails] bundle exec rake db: create error cannot be resolved [mysql]
- mysql - production environment column default value error