redhat7 安装 mysql5.7
1.下载包
https://downloads.mysql.com/archives/community/
https://dev.mysql.com/downloads/mysql/
https://downloads.mysql.com/archives/workbench/ 工具
2.卸载Mariadb
rpm -qa | grep mariadb rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64 --nodeps
3. MySQL安装
rpm -ivh mysql-community-common-5.7.10-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-5.7.10-1.el7.x86_64.rpm rpm -ivh mysql-community-client-5.7.10-1.el7.x86_64.rpm rpm -ivh mysql-community-server-5.7.10-1.el7.x86_64.rpm rpm -ivh mysql-community-devel-5.7.10-1.el7.x86_64.rpm
4.MySQL服务启动,查看root 初始密码
service mysqld start [root@l4cdb log]# cat /var/log/mysqld.log |grep -i password 2020-05-19T04:58:21.408080Z 1 [Note] A temporary password is generated for root@localhost: D34yB5*VD_fd
5.mysql 登录,
[root@ log]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.10 Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
6.更新root 密码
set password for 'root'@'localhost'='password'
7.开启远程登录
grant all privileges on *.* to root@'%' with grant option;
8.创建数据库
mysql> create database datacenter charset=utf8; Query OK, 1 row affected (0.00 sec) mysql> show database; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | datacenter | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.00 sec)
9.配置文件
[root@l4cdb mysql]# cat /etc/my.cnf|grep -v ^#|grep -v ^$ [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock symbolic-links=0 log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
每天进步一点点,多思考,多总结
版权声明:本文为CNblog博主「zaituzhong」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。