您的位置:首页 > 数据库 > MySQL

ubuntu下mysql的一些操作

2015-09-30 08:56 661 查看
ubuntu下的mysql配置

1->修改root密码

首先进入mysql:

    #mysql -u root -p

之后输入密码,进入mysql

    mysql> use mysql;

    mysql> update user set password = PASSWORD('newpassword') where user = 'root';

    mysql> flush privileges;

    mysql> exit;

2->远程连接mysql配置

(1)创建数据库:

    mysql> create database abc;

(2)创建用户:

    mysql> create user 'abc' identified by 'root';

(3)为用户授予某个数据库的权限:

    mysql> grant all privileges on abc.* to 'abc'@'%' identified by 'root' with grant option;

    mysql> flush privileges;

    mysql> exit;

3->进入安全模式修改密码

(1)进入到mysql安装目录

(2)停止mysql服务:

    # service mysqld stop

(3)进入安全模式:

    # mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

    # mysql -u root mysql

(4)修改密码:

    mysql> update user set password = PASSWORD('newpassword') where user = 'root';

    mysql> flush privileges;

    mysql> exit;

(5)重启服务:

    # service mysqld start
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql