189 8069 5689

mysql怎么连接密码,mysql输入密码

如何查询mysql 连接密码忘了怎么办

1.关闭正在运行的MySQL。

创新互联公司长期为上千客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为利辛企业提供专业的网站设计制作、网站制作,利辛网站改版等技术服务。拥有十余年丰富建站经验和众多成功案例,为您定制开发。

2.打开DOS窗口,转到mysql\bin目录。

3.输入mysqld --skip-grant-tables回车。

如果没有出现提示信息,那就对了。

4.再开一个DOS窗口,转到mysql\bin目录。

5.输入mysql回车,如果成功,将出现MySQL提示符

6. 连接权限数据库use mysql;

6.改密码: update user set password=password("520") where user="root";

7.刷新权限flush privileges;

8.退出 \q

9.注销系统,再进入。

安装完mysql后,怎样使用密码连接数据库

安装mysql,在终端输入如下命令并回车:

brew install mysql

等待大概5分钟(视网速而定)执行完毕后,会看到这一段提示:

/usr/local/Cellar/mysql/5.7.9/bin/mysqld --initialize-insecure --user=comet

== Caveats

We've installed your MySQL database without a root password. To secure it run:

mysql_secure_installation

可以看到brew在安装的时候已经初始过mysql了(不用再像网上说的再执行mysql_install_db命令),且当前没有密码

于是我按照它的提示,执行命令:

mysql_secure_installation

需要密码时,直接回车,出现了如下的错误:

Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

我在tmp目录下并没有看到mysql.sock这个文件。

我猜想它是在mysql服务启动时才会创建,于是我提前执行了如下的命令:

mysql.server start

提示 .SUCCESS!

这时tmp目录下有mysql.sock这个文件了,于是我继续执行 mysql_secure_installation

cometdeMacBook-Pro:~ comet$ mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords

and improve security. It checks the strength of password

and allows the users to set only those passwords which are

secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: N // 这个选yes的话密码长度就必须要设置为8位以上,但我只想要6位的

Please set the password for root here.

New password: // 设置密码

Re-enter new password: // 再一次确认密码

By default, a MySQL installation has an anonymous user,

allowing anyone to log into MySQL without having to have

a user account created for them. This is intended only for

testing, and to make the installation go a bit smoother.

You should remove them before moving into a production

environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y // 移除不用密码的那个账户

Success.

Normally, root should only be allowed to connect from

'localhost'. This ensures that someone cannot guess at

the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

... skipping.

By default, MySQL comes with a database named 'test' that

anyone can access. This is also intended only for testing,

and should be removed before moving into a production

environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

- Dropping test database...

Success.

- Removing privileges on test database...

Success.

Reloading the privilege tables will ensure that all changes

made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

Success.

All done!

OK!搞定,可以使用mysql -u root -p 进行密码连接了

如何修改mysql数据库连接密码

以root用户登录,命令:mysql -uroot -p 回车 输入密码;已经完成。修改MySQL是需要有mysql里的root权限的,下面介绍几种修改MYSQL数据库密码的方法:1、例如你的 root用户现在没有密码,你希望的密码修改为abc,那么命令是:mysqladmin -u root password abc2、如果你的root现在有密码了,那么修改密码为abc的命令是:mysqladmin -u root -p password youyou注意,命令回车后会问你旧密码,输入旧密码之后命令完成,密码修改成功。重新启动下mysql服务就可以啦。2、输入“mysql -uroot -p”,回车进入mysql命令状态;3、如果root原来有密码,mysql将提示输入原密码,再进入mysql命令状态;4、这里假设将root用户密码修改为mysql56,则在mysql命令状态下输入:提示Query OK,说明已更新。5、输入FLUSH PRIVILEGES;来保存修改内容,在mysql命令状态下输入:至此,密码修改完成。方法1 使用phpmyadmin,这是最简单的了,修改mySQL库的user表, 不过别忘了使用PASSWORD函数。 方法2 使用mySQLadmin,这是前面声明的一个特例。 mySQLadmin -u root -p password mypasswd 输入这个命令后,需要输入root的原密码,然后root的密码将改为mypasswd。 把命令里的root改为你的用户名,你就可以改你自己的密码了。

本地安装好MYSQL数据库后怎么连接

1、进行打开电脑Navicat for mysql已经安装好的,然后进行点击右上角的“连接”选项。

2、这样就会弹出了一个新建连接的窗口的界面中,在连接名中输入名称,而在主机名在本地的数据库,所以使用localhost即可,密码为空即可。

3、然后方便连接的数据库是否连接成功的话,那么就需要先测试下,进行点击连接测试。

4、可以看到的显示连接成功了,然后进行点击确定即可。

5、进入连接数据界面中,现在不能显示为需要的数据库,需要进行双击即可。

6、可以看到显示这个用户名的所有的数据库。


网站名称:mysql怎么连接密码,mysql输入密码
文章起源:http://cdxtjz.cn/article/phhpsg.html

其他资讯