安装命令:
groupadd mysql useradd -r -g mysql -s /bin/false mysql cd /usr/local tar zxvf /path/to/mysql-VERSION-OS.tar.gz ln -s full-path-to-mysql-VERSION-OS mysql cd mysql mkdir mysql-files chown mysql:mysql mysql-files #修改文件权限 chmod 750 mysql-files bin/mysqld --initialize --user=mysql bin/mysql_ssl_rsa_setup cp support-files/mysql.server /etc/init.d/mysqld #添加mysqld为系统服务 service mysqld start
bin/mysql -uroot -p
alter user user() identified by 'hadoop'; #修改密码
配置文件/etc/my.cnf
[mysqld] datadir=/usr/local/mysql/data socket=/usr/local/mysql/data/mysql.sock user=mysql server-id=1 port=3306 log-bin=/usr/local/mysql/binary/mysql1-bin #二进制日志文件 pid-file=/usr/local/mysql/pid/mysql.pid #pid文件 secure-file-priv='' expire_logs_days=7 [client] socket=/usr/local/mysql/data/mysql.sock
特别注意如果没有binary、pid等文件夹,需要手动创建,并且修改权限,检查所有者。