mysql configuration and remote login

Install mysql

sudo apt-get install mysql-server

Profiles

  • Location:
    /etc/mysql/mysql.conf.d/mysqld.cnf
  • The main configuration information:
    bind-address表示服务器绑定的ip,默认为127.0.0.1
    port表示端口,默认为3306
    datadir表示数据库目录,默认为/var/lib/mysql
    general_log_file表示普通日志,默认为/var/log/mysql/mysql.log
    log_error表示错误日志,默认为/var/log/mysql/error.log

Open service

sudo service mysql start

View Service

ps ajx|grep mysql

Restart Service

sudo service mysql restart

Login Client

sudo apt-get install mysql-client
mysql -uroot -p123456

mysql remote connection

  1. Open the configuration file, modify the binding
vim /etc/mysql/mysql.conf.d/mysqld.cnf

# bind-address = 127.0.0.1
  1. View user permissions
# 进入mysql执行, 查看所有用户的登录权限
select user,host from user;

# 加入新用户, 允许远程登录
# ken是用户名, 123456是密码
# 这里的%是指除了localhost以外的host
grant all privileges on *.* to  ken@"%" identified by "123456" with grant option;

  1. Ken and remote login using mysql 123456

Guess you like

Origin blog.csdn.net/bua200720411091/article/details/93378474