如何导入和导出数据库
出口
要导出数据库,打开终端,确保您未登录MySQL并键入,mysqldump -u [username] -p [database name] > [database name].sql您在命令中选择的数据库现在将导出到您的Droplet。
进口
要导入数据库,首先在MySQL shell中创建一个新的空白数据库作为数据的目标。CREATE DATABASE newdatabase;然后注销MySQL shell,并在命令行中键入以下命令:
mysql -u [username] -p newdatabaseWith that, your chosen database has been imported into your destination database in MySQL.
How to Reset a Root Password
When you first install MySQL, you have to set up your root password. However, should you forget it at any point, you can still recover it.Step One—Shut Down MySQL
In terminal, stop the MySQL process/etc/init.d/mysql stop
Step Two—Access MySQL Safe Mode
In safe mode, you will be able to make changes within the MySQL system with a root password alone, without the need for MySQL root password.sudo mysqld_safe --skip-grant-tables &Once safe mode has started up, log into MySQL and when prompted, use your standard root password.
mysql -u root mysql
Step Three—Set Up a New Password
Finally, set up the new MySQL root password by typing the command below. Replace "newpassword" with the password of your choice.update user set password=PASSWORD("newpassword") where User='root';Be sure to reload everything:
FLUSH PRIVILEGES;and you now have a new root password.
By Etel Sverdlov
这样,您选择的数据库已导入到MySQL中的目标数据库。
如何重置root密码
当您首次安装MySQL时,您必须设置root密码。但是,如果你忘记它在任何时候,你仍然可以恢复它。第一步 - 关闭MySQL
在终端中,停止MySQL进程/etc/init.d/mysql stop
第二步 - 访问MySQL安全模式
在安全模式下,您将能够在MySQL系统中单独使用root密码进行更改,而无需MySQL root密码。sudo mysqld_safe --skip-grant-tables &一旦安全模式启动,登录MySQL并提示,使用您的标准root密码。
mysql -u root mysql
第三步 - 设置新密码
最后,通过键入以下命令设置新的MySQL root密码。将“newpassword”替换为您选择的密码。update user set password=PASSWORD("newpassword") where User='root';一定要重新加载一切:
FLUSH PRIVILEGES;并且您现在有一个新的root密码。
作者Etel Sverdlov