2.CentOS 7.3服务器环境搭建-mysql数据库搭建
来源:互联网 发布:北京谷歌seo推广 编辑:程序博客网 时间:2024/05/20 22:02
1.首先下载必备的命令。
vim命令(https://www.oschina.net/news/43167/130-essential-vim-commands)
安装命令:yum -y install vim*
wget命令:yum -y install wegt
2.使用国内镜像源,本人用的是阿里的镜像。(
网易开源镜像站:http://mirrors.163.com/
中科大的Linux安装镜像源:http://centos.ustc.edu.cn/
搜狐的Linux安装镜像源:http://mirrors.sohu.com/
北京首都在线科技:http://mirrors.yun-idc.com/
)
1.cd /etc/yum.repos.d/Centos-Base.repo
2.先拷贝这个文件:mv Centos-Base.repo Centos-Base.repo.copy
3.wget -o Centos-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo。
(根据你的服务器版本下载 Centos-5,6,7)
4.刷新缓存:yum makecache
SUCCESS!
3.下载安装mysql数据库
1.切换到opt目录下载mysql安装包
cd opt/mysql
wget http://repo.mysql.com/mysql57-community-release-el7-9.noarch.rpm(下载mysql一路y下去)
yum install mysql-server (安装mysql服务)
2.这时候检查mysql是否启动
/bin/systemctl status mysqld.service
若没启动输入/bin/systemctl start mysqld.service
然后获得root登录密码:
grep "password" /var/log/mysqld.log
2017-04-14T11:36:20.585006Z 1 [Note] A temporary password is generated for root@localhost: Qk<U,b6!eOm<
3.用初始密码登录mysql
[root@localhost log]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.18
Copyright (c) 2000, 2017, 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.
登录成功!
接着更改登录密码!这初始密码太坑爹了,肯定要改。。。
但是mysql5.7的密码采用了密码强度验证插件 validate_password ,密码也得设计的超级复杂。。
mysql> set password=password('密码');
设置任何ip下可以访问:
mysql> grant all privileges on *.* to root@"%" identified by "密码";
刷新权限
flush privileges;
启动 MySQL 服务:
service mysqld start
关闭 MySQL 服务:
service mysqld stop
重启 MySQL 服务:
service mysqld restart
查看 MySQL 的状态:
service mysqld status
设置mysql字符集:
打开etc/my.cnf
[client]
default-character-set=utf8
[mysqld]
character_set_server=utf8
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
重启数据库,即可生效。
4.用Navicat连接Mysql的连接不上,开启系统防火墙
systemctl stop firewalld
- 2.CentOS 7.3服务器环境搭建-mysql数据库搭建
- centos mysql 环境搭建
- centos环境搭建java web,mysql,ftp服务器环境
- centos 搭建php服务器环境
- centos 7服务器环境搭建
- CentOS环境搭建SMTP服务器
- 搭建基于CentOS+MySQL的EA服务器环境
- 云服务器 centos mysql搭建
- CentOS 6.4 FTP服务器及mysql数据库搭建
- linux centos下mysql数据库的主从复制环境搭建
- linux centos下mysql数据库的主从复制环境搭建
- Centos 7.0搭建Mysql数据库
- centos 7 搭建mysql数据库
- MAC OS搭建Apache服务器PHP环境及MySQL数据库
- 从零搭建LNMP环境(三) - 安装MySQL数据库服务器
- MySQL数据库服务器搭建指南
- Linux 搭建数据库服务器(mysql)
- mysql数据库环境的搭建
- Android5.1蓝牙电话分析及demo
- css3侧滑栏
- [乱搞] BZOJ 4436 [Cerc2015]Kernel Knights
- LINUX搭建部署TOMCAT+JDK+MYSQL环境
- PHP 会话控制 cookie与session 全解析
- 2.CentOS 7.3服务器环境搭建-mysql数据库搭建
- 浅谈Java中的equals和==
- 使用sublime编译运行C程序
- jquery 便利所有inout值放到数组
- 网宿科技软件工程师面试
- centos系统有多个内核,修改默认启动内核
- MyBatis--关联关系查询--自关联--一对多--查询指定父节点的所有子节点
- JAVA开源爬虫列表及简介
- 常见浏览器兼容性问题与解决方案