服务器上 MySql 8.0.16创建远程连接账号、获取初始密码、修改密码、重启命令等

一、 创建远程连接账号

  1. 终端连接服务器

    ssh -p 端口号 用户名@ip地址

    例如:ssh -p 22 yyy@1.2.3.4

  2.进入mysql

    mysql -u 用户名 -p

    然后输入密码

  3.创建远程账号

    3.1 use mysql;

 

    3.2 select  User,authentication_string,Host from user;

 

    3.3 create user 用户名@'%' identified by '密码'

 

    3.4 grant all privileges on *.* to 用户名@'%' with grant option;

 

    3.5 flush privileges;

  按步骤即可创建成功

 

 二、获取初时密  

 

grep 'temporary password' /var/log/mysqld.log 

或者

cat /var/log/mysqld.log | grep 'temporary password'

 

三、修改密码

  1.与第一步一样进入mysql

  2. 输入命令

    use mysql;

  3.输入命令

    select user,host from user;

  4.输入命令  

    alter user '用户名'@'%' identified by '新密码';

  5.退出 quit

 

四、启动、停止、重启、查看服务、查看mysql配置等命令

  1. 与第一步一样 进入服务器

  2. 启动  service mysqld start

  3. 停止  service mysqld stop

  4. 重启  service mysqld restart

  5. 查看服务  service mysqld status

  6. 查看mysql配置  cat /etc/my.cnf

  

四、配置服务器忽略表的大小写问题

  1. 进入服务器

  2.vim /etc/my.cnf

  3.添加一行

    lower_case_table_names=1

 

 

posted @ 2019-11-07 15:47  Mr_R  阅读(480)  评论(0编辑  收藏  举报