1.解压mysql
tar -zxvf 路径
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
cd /usr/local
cd mysql
mkdir mysql-files
chown mysql:mysql mysql-files
chmod 750 mysql-files
bin/mysqld --initialize --user=mysql
保存密码: Mk>YLoo7I95x
Vim /etc/profile
export PATH=$PATH:/usr/local/mysql/bin
Source /etc/profile
Cd support-files/
./mysql.server start
cp support-files/mysql.server /etc/init.d/mysql.server
在/etc/my.cnf配置如下
[client]
port = 13306
socket = /tmp/mysql.sock
[mysqld]
port = 13306
socket = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir= /usr/local/mysql/data
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
登录数据库:
Mysql -uroot -p
如果环境异常,安装
yum install libncurses*
第一次登录修改密码
ALTER USER USER() IDENTIFIED BY '123456';
打开远程连接:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
刷新权限:
flush privileges;