$> sudo yum install mysql mysql-server mysql-workbench
# 启动mysql
$> sudo systemctl start mysqld.service
# 设置自动启动
$> sudo systemctl enable mysqld.service
- 修改默认字符集,修改/etc/my.cnf文件
[mysqladmin]
user=root
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
character-set-server=UTF8
port=3306
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
default-character-set=UTF8
port=3306
socket=/var/lib/mysql/mysql.sock
-
查看默认字符集
mysql> show variables like 'collation_%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)
设置root密码
# 未设置过root密码
mysqladmin -u root password 123456
# 设置过密码的
[root@yuan yuan]# mysqladmin -u root -p password
Enter password: ******
New password: 123456
Confirm new password:123456
[root@yuan yuan]#
阅读(1907) | 评论(0) | 转发(0) |