Ubuntu16.04 LTS에서 MySQL 데이터베이스를 설치하고 루트 사용자가 원격 연결을 허용하도록 설정

1660 단어 백엔드
1. SQL 서버
   명령은 한 줄만 필요합니다: apt-get install mysql-server 설치 과정에서 루트 사용자의 비밀번호를 설정해야 합니다.
2. 루트 사용자가 바인딩한 연결 주소 변경
  • MySQL 데이터베이스에 로그인: mysql -u root -p, 방금 설정한 비밀번호를 입력하고 데이터베이스에 로그인
  • 업데이트 권한: mysql> grant all privileges on *.* to 'root'@'%' identified by '* *' with grant option;
  • 리셋 권한: mysql>flush privileges;
  • 3. 프로필을 변경하면 원격 IP 주소 연결을 허용합니다
      MySQL 최신 버전과 원격 IP 주소 연결에 대한 설정 파일이 /etc/mysql/mysql.conf.d/mysqld.cnf 로 변경되었으므로 명령을 입력하십시오: sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf, 이 부분을 찾으십시오:
    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    bind-address            = 127.0.0.1
    #
    # * Fine Tuning
    

    다음 행에 주석을 둡니다. bind-address = 127.0.0.1:
    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    #bind-address           = 127.0.0.1
    #
    #* Fine Tuning
    

    4. MySQL: sudo service mysql restart 재부팅

    좋은 웹페이지 즐겨찾기