@lgh-dev
2017-12-06T07:00:02.000000Z
字数 1193
阅读 625
PHP
# yum list installed | grep mysql
# yum -y remove mysql-libs.x86_64
# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
# rpm -ivh mysql-community-release-el6-5.noarch.rpm
# yum repolist all | grep mysql
# yum install mysql-community-server
# yum -y install mysql-server mysql
# service mysqld start
由于mysql刚刚安装完的时候,mysql的root用户的密码默认是空的,所以我们需要及时用mysql的root用户登录(第一次回车键,不用输入密码),并修改密码
# mysql -u root
# use mysql;
# update user set password=PASSWORD("这里输入root用户密码") where User='root';
授权(自动创建)一个mysql的非root的aaa用户,能访问localhost上的testdb数据库,密码是xxxx,最后刷新权限
# grant all privileges on testdb.* to aaa@localhost identified by 'xxxx';
# flush privileges;
# CREATE DATABASE
databaseDEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
# exit;
# chkconfig --list | grep mysqld
# chkconfig mysqld on
# mysql_secure_installation