美文网首页
前端运维之软件安装--node、mysql

前端运维之软件安装--node、mysql

作者: 缓慢的蜗牛 | 来源:发表于2021-12-21 15:52 被阅读0次

    前言

    因本人是前端程序员,所以比较熟悉node,及npm 的安装方法,所以先安装的node。
    查看服务器位数

    [root@VM-24-14-centos lib]# uname -a
    返回:Linux VM-24-14-centos 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
    

    进入腾讯云服务器目录

    [root@VM-24-14-centos /]# cd usr/lib
    

    一、安装Node.js

    1)检查服务器是否安装了node、npm

    [root@VM-24-14-centos lib]# node -v
    [root@VM-24-14-centos lib]# npm -v
    

    2)如果没有node及npm 则进行安装(本人安装的版本为8)

    [root@VM-24-14-centos lib]# curl -sL https://rpm.nodesource.com/setup_8.x | bash -
    下载中·····
    [root@VM-24-14-centos lib]# sudo yum install -y nodejs
    
    安装成功红色框

    3)检查服务器是否安装成功node、npm

    [root@VM-24-14-centos lib]# node -v
    v8.17.0
    [root@VM-24-14-centos lib]# npm -v
    6.13.4
    

    二、安装MySQL

    1、检查Linux服务器是否有Mysql

    [root@VM-24-14-centos ~]# rpm -qa|grep mysql*
    [root@VM-24-14-centos ~]# rpm -qa|grep -i mysql
    

    如有,必须卸载干净,否则后面安装会报各种错误。
    2、查看有没有安装包:

    [root@VM-24-14-centos lib]# yum list mysql*
    

    3、查看本地环境安装MySQL版本安装版本统一避免版本错误
    1)链接本地数据库,新建查询

    select version() from dual;
    返回:version 5.6.46-log
    

    4、安装MySQL

    [root@VM-24-14-centos lib]# yum install mysql
    
    安装完成

    5、安装mysql-devel

    [root@VM-24-14-centos lib]# yum install mysql-devel
    
    image.png

    6、安装 mysql-server

    [root@VM-24-14-centos lib]# yum install mysql-server
    

    报错:

    [root@heyong_jd ~]# yum install -y mysql-server
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    No package mysql-server available.
    Error: Nothing to do
    

    解决办法:

    wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
    rpm -ivh mysql-community-release-el7-5.noarch.rpm
    

    重新安装

    [root@VM-24-14-centos lib]# yum install mysql-server
    
    安装完成

    8、修改MySQL密码
    1)输入进入MySQL的时候报错

    [root@VM-24-14-centos /] mysql -u root -p
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)。
    $$新安装因此没有修改过它的原始密码
    

    2)停止MySQL服务:(如果service mysql stop执行不成功,使用/etc/init.d/mysql restart即可----同理步骤三)

    [root@VM-24-14-centos /]# service mysql stop;
    
    1. 打开 vim etc/my.cnf 文件或 vim etc/mysql/my.cnf (每个人的路劲不同),向其中加入skip-name-resolve 和 skip-grant-tables,并保存 ;编辑 为 i 退出不保存为 :q 保存退出为 :wq
    [root@VM-24-14-centos /]# vim etc/my.cnf  
    加入以下红色位置
    skip-name-resolve
    skip-grant-tables
    
    image.png

    4)启动MySQL

    [root@VM-24-14-centos /]# service mysql start
    
    1. 输入mysql -u root -p,进入mysql命令行界面
    [root@VM-24-14-centos /]# mysql -u root -p
    
    image.png

    6)在命令行界面中,使用use mysql,进入对应的mysql数据库中;

    mysql> use mysql
    
    image.png
    1. 执行update操作,UPDATE user SET authentication_string = PASSWORD('新的密码') WHERE User = 'root';这样的话,密码修改成功。下次就可以用最新密码了,而不会出现上述的错误了。
    UPDATE user SET authentication_string = PASSWORD('新的密码') WHERE User = 'root';
    

    温馨提示

    skip-name-resolve 禁止MySQL Server 对外部链接进行DNS解析,可以消除MySQL进行DNS解析的时间。但是如果开启了该选项,那么所有的远程主机连接授权都要使用IP地址,否则MySQL无法正常处理连接请求。
    skip-grant-tables 系统对任何用户的访问都不做任何的访问控制,即在忘记密码的情况下,可以直接登录数据库
    更改密码成功后,可以把这两项去掉的!

    9、数据库工具链接这里用的是navicat


    image.png

    相关文章

      网友评论

          本文标题:前端运维之软件安装--node、mysql

          本文链接:https://www.haomeiwen.com/subject/opotqrtx.html