<commit_before># MySQL

### CentOS 7 安装 MySQL
- [参考网页](https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/)
- sudo rpm -Uvh mysql57-community-release-el6-n.noarch.rpm
- yum repolist all | grep mysql
- yum repolist enabled | grep mysql
- sudo yum install mysql-community-server
- sudo service mysqld start
- sudo service mysqld status
- sudo grep 'temporary password' /var/log/mysqld.log
- mysql -uroot -p
- ALTER USER 'root'@'localhost' IDENTIFIED BY 'My<PASSWORD>!';
- sudo yum list installed | grep "^mysql"

### utf8mb4
- 使用utf8mb4代替utf8
- utf8最多是3个字节，utf8mb4最多是4个字节
- utf8mb4可以支持更多的字符，如：Emoji表情，不常用的汉字
- mb4 的意思是：most bytes 4
- 5.5.3以后的版本才支持(select version();)
- 可以使用varchar代替char

### create database
- `create database if not exists dbname default charset utf8mb4 collate utf8mb4_unicode_ci`

### create table
```sql
create table if not exists users (
  id int(10) auto_increment,
  email varchar(128) null,
  password varchar(255) null,
  primary key(id),
  unique key users_unique_email(email)
)engine=InnoDB default charset utf8mb4 collate utf8mb4_unicode_ci;
```

### 设置时区
```sql
# 全局
set global time_zone = '+8:00'
# 当前
set time_zone = '+8:00'
# 立即生效
flush privileges;

# 配置文件
[mysqld]
default-time_zone = '+8:00'

# 查看时间
select now();
```


<commit_msg>restart mysql<commit_after># MySQL

### CentOS 7 安装 MySQL
- [参考网页](https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/)
- sudo rpm -Uvh mysql57-community-release-el6-n.noarch.rpm
- yum repolist all | grep mysql
- yum repolist enabled | grep mysql
- sudo yum install mysql-community-server
- sudo service mysqld start
- sudo service mysqld status
- sudo grep 'temporary password' /var/log/mysqld.log
- mysql -uroot -p
- ALTER USER 'root'@'localhost' IDENTIFIED BY 'My<PASSWORD>!';
- sudo yum list installed | grep "^mysql"

### utf8mb4
- 使用utf8mb4代替utf8
- utf8最多是3个字节，utf8mb4最多是4个字节
- utf8mb4可以支持更多的字符，如：Emoji表情，不常用的汉字
- mb4 的意思是：most bytes 4
- 5.5.3以后的版本才支持(select version();)
- 可以使用varchar代替char

### create database
- `create database if not exists dbname default charset utf8mb4 collate utf8mb4_unicode_ci`

### create table
```sql
create table if not exists users (
  id int(10) auto_increment,
  email varchar(128) null,
  password varchar(255) null,
  primary key(id),
  unique key users_unique_email(email)
)engine=InnoDB default charset utf8mb4 collate utf8mb4_unicode_ci;
```

### 设置时区
```sql
# 全局
set global time_zone = '+8:00'
# 当前
set time_zone = '+8:00'
# 立即生效
flush privileges;

# 配置文件
[mysqld]
default-time_zone = '+8:00'

# 查看时间
select now();
```

### 重启
`/etc/init.d/mysql restart|start|stop`



{'fraction_non_alphanumeric': 0.12717433320448396, 'fraction_numerical': 0.03556242752222652, 'mean_word_length': 4.471458773784355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5782811', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1094, 'n_words': 258}