标签:mysql
1.安装
yum -y install mysql mysql-devel mysql-server 加入开机启动项 chkconfig --add mysqld 加入开机启动 chkconfig mysqld on
2.设置root密码
mysqladmin -uroot password "123456"
3.进入数据库
4.查看数据库
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec)
数据库目录为/var/lib/mysql/
5.更改密码
原密码为123456
法一:
$mysqladmin -uroot -p123456 password "654321" $mysql -uroot -p654321 -s && echo $? mysql> mysql> \q 0
法二:
mysql> update mysql.user set password=password("654321") where user = ‘root‘ and host = ‘localhost‘; mysql> flush privileges; 一定要刷新权限,不然还是原来的密码 Query OK, 0 rows affected (0.00 sec)
6.授权远程管理用户
mysql> grant all on *.* to ‘admin‘@‘%‘ identified by ‘admin‘ with grant option; mysql> flush privileges; 刷新权限,使其生效。 Query OK, 0 rows affected (0.00 sec)
标签:mysql
原文地址:http://xoyabc.blog.51cto.com/7401264/1718335