Centos7系统MySQL安装:

  1. wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
  2. rpm -ivh mysql-community-release-el7-5.noarch.rpm
  3. yum install mysql-community-server
  4. MySQL服务重启:service mysqld restart
  5. 设置root用户名密码:
    mysql -u root
    mysql> set password for ‘root’@‘localhost’ = password(‘mypasswd’);
    mysql> exit
    6.MySQL版本查询:mysql --version
    7.修改字符集:
    查看当前 MySQL 字符集:mysql> show variables like ‘character%’;
    这里写图片描述
    修改成utf8: vim /etc/my.cnf,添加如下配置:
    [mysqld]
    character_set_server = utf8
    [mysql]
    default-character-set = utf8
    重启MySQL:service mysqld restart
    重新查询:mysql> show variables like ‘character%’;
    这里写图片描述
    8.用navicat远程连接Linux系统的MySQL:
    注意要关闭防火墙(centos7命令:systemctl stop firewalld.service
    mysql>GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘lwl980429’ WITH GRANT OPTION;
    mysql> flush privileges;
    格式:grant 权限 on 数据库.* to 用户名@登录主机 identified by “密码”; 
    mysql>grant all privileges on . to root@’%’ identified by ‘root’;
    mysql>flush privileges;
    这里写图片描述

tar -zxvf命令详解:
x : 从 tar 包中把文件提取出来
z : 表示 tar 包是被 gzip 压缩过的,所以解压时需要用 gunzip 解压
v : 显示详细信息
f xxx.tar.gz : 指定被处理的文件是 xxx.tar.gz

Ubuntu设置允许root用户登录:
sudo passwd
vim /etc/ssh/sshd_config
找到 PermitRootLogin 这项 将其改为 yes
service ssh restart

Logo

更多推荐