CentOS7.6网卡自启动、ifconfig和安装mysql

写在前面

今天初学了下CentOS7.6系统,vmware配置好该系统以后,发现有不少东西都没有初始化,相比起ubuntu仍是更须要基础一些。
本文主要记录yum和ifconfig报错,以及mysql安装。阅读本文,你大概须要10分钟时间。html

一.网卡未启动,yum无效

  1. 输入命令cd /etc/sysconfig/network-scripts
  2. ls -a查看文件,能够看到文件夹下有 ifcfg-ens33 文件。
  3. 设置网卡开机自启动:sudo vim ifcfg-ens33->找到ONBOOT=no->并修改成ONBOOT=yes
    注意:此操做必需要sudo获得管理员权限。
    不然在退出时会出现没法保存:ifcfg-ens33 E212:Can't open file or writing
  4. 最后reboot重启便可。

二.ifcofig的配置

  1. 输入ifconfig时发现:-bash: ifconfig: command not found,
    接着cd /sbin 发现确实没有ifcofig
  2. yum install ifcofig 发现没有ifcofig的包!报错以下mysql

    No package ifconfig available.
    Error: Nothing to do
  3. 输入命令yum search ifconfig,找到 Mathed:ifcofig 发现须要net-tools.x86_64
  4. 故咱们就下载这个工具linux

    yum install net-tools.x86_64
  5. 此时ifconfig就能正常执行了。

三.安装mysql

1.下载安装mysqlsql

  • yum安装wgetubuntu

    yum -y install wget
  • 下载并安装mysql官方的yum repositoryvim

    wget -i -c https://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm

    而后使用上面的命令安装yum repositorycentos

    yum -y install mysql57-community-release-el7-10.noarch.rpm
  • 安装mysql服务器bash

    yum -y install mysql-community-server

2.配置mysql服务器

  • 启动mysql
    systemctl start mysqld.service
  • 找出root的默认密码,并记录
    grep "password" /var/log/mysqld.log
  • 链接mysql
    mysql -uroot -p
    此时输入上一步记录的密码,完成链接
  • 此时你会发现,不管你输入任何命令,都会让你先更改默认密码。可是mysql通常会判断你更改的密码过于简单。因而咱们先更改mysql的密码规则:工具

    mysql> set global validate_password_policy=0;
    mysql> set global validate_password_length=1;
  • 修改密码:ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

最后

参考连接:

做为开发者,也是须要懂一些linux的。路漫漫其修远兮!

相关文章
相关标签/搜索