centos下安装JAVA开发工具(3)------Mysql

安装MySQL

  1. 上传MySQL-server-5.5.48-1.linux2.6.x8664.rpm到Linux上
  2. 解压ta包 得到一大堆rpm文件
    tar -xvf MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tar

      MySQL-client-5.6.25-1.el6.x86_64.rpm
      MySQL-devel-5.6.25-1.el6.x86_64.rpm
      MySQL-embedded-5.6.25-1.el6.x86_64.rpm
      MySQL-server-5.6.25-1.el6.x86_64.rpm
      MySQL-shared-5.6.25-1.el6.x86_64.rpm
      MySQL-shared-compat-5.6.25-1.el6.x86_64.rpm
      MySQL-test-5.6.25-1.el6.x86_64.rpm
  3. rpm安装mysql-server
    rpm -ivh MySQL-server-5.6.25-1.el6.x86_64.rpm

  4. 出现错误
    file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64

  5. 卸载 mariadb-libs-1:5.5.56-2.el7.x86_64 解决依赖
    rpm -e –nodeps mariadb-libs-1:5.5.56-2.el7.x86_64
  6. 再次执行第三步 安装server
  7. 安装客户端
    rpm -ivhMySQL-client-5.6.25-1.el6.x86_64.rpm
  8. 启动mysql
    service mysql start
  9. 初始化mysql
    /usr/bin/mysql_secure_installation
  10. 测试mysql
    mysql -u root -p

注意事项

初始化mysql时可能出现问题

  • 先关闭mysql
    service mysql stop
  • 跳过检查
    service mysql start –skip-grant-tables
  • 进入mysql 设置密码

    mysql> update mysql.user set password=PASSWORD('newpassword') where User='root'; 
    mysql> flush privileges; 
    mysql> quit 
  • 重启mysql
    service mysql start
  • 连接
    mysql -u root -p

备注

  • 修改mysql密码
    set password for root@localhost = password('123');
    原文作者:source
    原文地址: https://segmentfault.com/a/1190000015364161
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞