sudo yum install
mysql
sudo yum install
mysql-server
sudo yum install
mysql-devel
sudo
chgrp -R
mysql /
var/lib/
mysql
sudo
chmod -R 770 /
var/lib/
mysql
sudo service mysqld start
修改密码
/usr/bin/mysqladmin -u root password yourpasswordhere
创建新用户
CREATE USER 'myuser'@'localhost' IDENTIFIED BY -> 'yourpasswordhere'; GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'localhost' -> WITH GRANT OPTION; CREATE USER 'myuser'@'%' IDENTIFIED BY 'yourpasswordhere'; GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' -> WITH GRANT OPTION;
创建新DB,并分配用户和权限
CREATE DATABASE `mydb` CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL ON `mydb`.* TO `username`@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;