MySql 5.7 安装

# rpm 安装  rpm -ivh xxx.rpm

# rpm 卸载 rpm -e –nodeps xxx.rpm

----- linux 安装mysql -----

         0.  导入jar包 到opt/mysql

        

         1.     检查

                   rpm -qa|grep mariadb

                   MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可

                  。开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,

                  因此社区采用分支的方式来避开这个风险。

                 

                  如果存在则卸载

                  请先执行卸载命令:rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64

                 

                  必须有如下两个包

     rpm -qa|grep libaio

                   

                  rpm -qa|grep net-tools

                 

         2.     授权 chmod -R 777 /tmp

        

         3.     安装mysql

                  rpm -ivh mysql-community-common-5.7.16-1.el7.x86_64.rpm

                  rpm -ivh mysql-community-libs-5.7.16-1.el7.x86_64.rpm

                  rpm -ivh mysql-community-client-5.7.16-1.el7.x86_64.rpm

                  rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm

                 

         4.     查看版本

                  mysqladmin --version命令

                 

         5.     初始化服务

                  mysqld --initialize --user=mysql

                 

         6.     查看密码

                  cat /var/log/mysqld.log

                  root@localhost: 后面就是初始化的密码

                 

         7.     相关服务:

                  启动:systemctl start mysqld.service

                  停止:systemctl stop mysqld.service

    8.     登录修改密码

                  mysql -uroot -p

                 

                  ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

                  ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';

                 

         9.     修改字符集

                  vim  /etc/my.cnf

                  在最后加上中文字符集配置

                  character_set_server=utf8

                  并重启

                  systemctl restart mysqld.service

         10.   授权远程连接

                  再次登录mysql 授予远程连接

                 

                  grant all privileges on *.* to root@'%'  identified by 'root';

                 

                  刷新权限:

                 

                  flush privileges;

                 

                  关闭防火墙

                  一次关闭

                  systemctl stop firewalld.service

                  永久关闭

                  systemctl disable firewalld.service

                 

                  并重启

                  systemctl restart mysqld.service

                 

                  导入mysql.sql 文件

                  source /root/mysql.sql

 

posted @ 2020-11-09 00:24  曹丽是我女朋友。  阅读(57)  评论(0编辑  收藏  举报