1. install MySQL online
1)download rpm for install mysql repo
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2)install mysql-community-release-el7-5.noarch.rpm
$ rpm -ivh mysql-community-release-el7-5.noarch.rpm
after the installation, there will be two more repos:
/etc/yum.repos.d/mysql-community.repo,
/etc/yum.repos.d/mysql-community-source.repo。
3)yum install mysql
yum install -y mysql-community-server
4) restart mysql service。
service mysqld restart
2. set mysql password
after installing mysql,root user do not have password,login mysql using:
```
$ mysql -u root
```
mysql>set password using:
```
set password for 'root'@'localhost' =password('root');
```
no need to restart mysqld service.
3. to allow remote access:
Mysql为了安全性,在默认情况下用户只允许在本地登录,可是在有此情况下,还是需要使用用户进行远程连接,因此为了使其可以远程需要进行如下操作:
```
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES;
```
add port access in firewall
```
firewall-cmd --zone=public --add-port=3306/tcp --permanent
```
reload firewall
```
firewall-cmd --reload
```
4. alter database charset(default, latin1, change it into utf8):
mysql> show variables like '%character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
修改 /etc/my.cnf 在mysqld下加入
character-set-server=utf8
5. 默认,linux下的mysql是区分大小写的,可以通过设置修改。
修改 /etc/my.cnf 在mysqld下加入
lower_case_table_names=1
Centos7.3下安装高版本mysql, 参见以下:
https://www.cnblogs.com/wishwzp/p/7113403.html
- 第一章 Linux
- 1. Linux安装和网络配置
- 2. Linux基本命令
- 3. Xshell和winscp
- 4. VIM编辑器
- 5. 安装软件
- 5.1 安装JDK
- 5.2 安装TOMCAT
- 5.3 安装MySql
- 5.4 安装Nginx
- 5.5 部署工程
- 第二章 Nginx
- 1. 安装Nginx
- 2. 配置Nginx
- 2.1 配置静态服务器
- 2.2 配置反向代理
- 2.3 配置负载均衡
- 2.4 配置动静分离
- 2.5 跨域访问
- 第三章 Redis
- 1. 安装Redis
- 2. JAVA操作Redis
- 3. Redis事务
- 4. Redis持久化
- 5. 主从复制和集群
- 6. Redis实现Session共享
- 第四章 MySQL主从复制
- 4.1 MyCat安装
- 4.2 MySQL主从复制
- 4.3MySQL读写分离
- 第五章 ActiveMQ
- 5.1 Queue
- 5.2 Topic
- 第六章 FastDFS图片服务器
- 第七章