1.安装mysql
[root@liang~]# yum list | grep mysql
[root@liang~]# yum install -y mysql-server mysql mysql-devel
查看是否按照成功
[root@liang~]# rpm -qi mysql-server
2.修改mysql配置文件/etc/my.cnf
[mysqld]
datadir=/data/mysql_data/mysql
socket=/data/mysql_data/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
character-set-server=utf8
symbolic-links=0
max_connections=1000
innodb_buffer_pool_size=80M
max_allowed_packet = 50M
tmp_table_size=512M
max_heap_table_size=1000M
[mysql]
socket=/data/mysql_data/mysql/mysql.sock
[mysqld_safe]
datadir=/data/mysql_data/mysql
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
3.启动mysql
[root@FSL-host2mysql_data]# service mysqld start
查看mysql启动日志:cat /var/log/mysqld.log
/etc/init.d/mysqld stop
数据库端口号3306
4.修改mysql默认数据文件路径问题:
[root@dataselinux]# setenforce 0
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式
彻底关闭,vi /etc/selinux/config 修改 SELINUX=disabled
4.创建用户和删除用户:
CREATE USER 'abc'@'%' IDENTIFIED BY 'abc123';
GRANT ALL PRIVILEGES ON *.* TO abc@'%' IDENTIFIED BY 'abc123';
mysql> flush privileges;