电玩城打鱼捕鱼-专业24小时上下分

MySQL修改密码和忘记ROOT密码,mysql开启远程服务

六月 6th, 2019  |  电玩城上下分数据库

mysql开启远程服务

进入mysqlserver

如下:

Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 810
Server version: 5.6.10 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights
reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input
statement.
mysql>

敲入如下命令:

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘123456’ WITH
GRANT OPTION;

FLUSH PRIVILEGES;

进入mysqlserver 如下: Enter
password: ****** Welcome to the MySQL monitor. Commands end with ;
or \g. Your MySQL connection id is 810 Server version:…

1、关闭数据库

想必大家在命令行操作mysql的时候会十分发愁现在的操作的是那个数据库吧,至少我就纠结过,可能您会说我打一条命令不就知道了,是的这样做确实可以的。
可是今儿给大家介绍个好用的命令–prompt

脚本:[root@mysql etc]# service mysql stop 

复制代码 代码如下:

2、使用脚本: mysqld_safe –skip-grant-tables 启动数据库 

[root@fsailing1 ~]# mysql -uroot -p –prompt=”\\u@\\h:\\d
\\r:\\m:\\s>”
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 378
Server version: 5.0.95 Source distribution

使用/usr/bin/mysqld_safe –skip-grant-tables&启动数据库 

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights
reserved.

3、使用空密码进入数据库(mysql命令后直接回车) 

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

[root@mysql ~]# mysql

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input
statement.

Welcome to the MySQL monitor. Commands end with ; or \g.

root@localhost:(none) 08:23:32>use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Your MySQL connection id is 3

Database changed
root@localhost:test 08:23:44>exit;

Server version: 5.6.20-enterprise-commercial-advanced MySQL Enterprise
Server – Advanced Edition (Commercial)

这样做的好处就是让我们大家在操作数据库时更加方便快捷。

Copyright (c) 2000,
2014, Oracle and/or its
affiliates. All rights reserved.

您也可以在在my.cnf配置文件里进行配置:

Oracle is a registered trademark of Oracle Corporation and/or its

复制代码 代码如下:

affiliates. Other names may be trademarks of their respective

[mysql]
prompt=mysql(\\u@\\h:\\d)>

owners.

default-character-set=utf8

标签:,

Your Comments

近期评论

    功能


    网站地图xml地图