본문 바로가기
오류해결

MYSQL 설치 WSL(service오류, Failed to connect to bus 오류 해결)

by chief_sac 2021. 9. 3.
반응형

문제발생

MySQL 설치중 발생한 문제

sudo systemctl start mysql 
// 입력시 
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
// 라는 에러 발생

 

 

해결방법 및 WSL 에서 MySQL 설치하고 열기


 

  1. wsl을 열고 Ubuntu 패키지 업데이트를 한다.
sudo apt update

 

 

   2. 업데이트되면 다음을 통해 MySQL을 설치

sudo apt install mysql-server

 

 3. 버전확인해본다

 

mysql --version

 

 4. MySQL 서버를 시작합니다.

sudo /etc/init.d/mys ql start

 

 5. 보안 스크립트 프롬프트를 시작합니다.

sudo /etc/init.d/mysql start

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

--MySQL 암호의 강도를 테스트하는 데 사용할 수 있는 암호 유효성 검사 플러그 인을 설정할지 여부
Press y|Y for Yes, any other key for No: n
Please set the password for root here.
--암호 설정
New password:

Re-enter new password:
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
--익명 사용자를 제거할지 여부
Remove anonymous users? (Press y|Y for Yes, any other key for No) : n

 ... skipping.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
--루트 사용자가 로컬 및 원격으로 로그인할 수 있도록 허용할지 여부
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

--테스트 데이터베이스를 제거할지 여부
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
--권한 테이블을 즉시 다시 로드할지 여부
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

 

 

 6. Mysql프롬프트가 열리고 (혹시 안열리면 sudo mysql)

 

 

 

 7. 사용가능한 데이터베이스를 보려면

SHOW DATABASES; --를입력하면 아래와같은 그림이 나온다
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

 

 

문제 발생이유는 WSL환경에서 설치한 우분투의 경우 기본 경로가 달라서 정확한 명시를 하면서 서버를 실행시켜야하는것 같음(추측)

반응형