Ensure that the running database on the line is unavoidable I small white, because the company on-Line no way to the whole server, deep experience to the server big God domineering, so in order to increase memory, service the majority of staff friends record
Linux MySQL forgot root password cannot log in to MySQL
1, modify the MySQL configuration file/etc/my.conf under [mysqld] Add a line skip-grant-table;
2. After modifying the configuration file, restart the MySQL service mysqld Restart
3, then use the regular command to log on to MySQL mysql-u root-p When prompted to enter the password, just click on the return.
4, log in to MySQL after the execution of the statement to change the password update set Password=passeord (' root ') where user = ' root '; At this time passeord (' root ') root is the password of the newly-set root user
5. Take the first step, remove the skip-grant-table you added, then restart MySQL
First, Linux MySQL create, delete database
Use the command to enter MySQL
creat database name;
This creates a database of your own.
Use show databases to view all databases
Second, delete the database
Execute command drop databases database name;
Third, MySQL import, export database
Method One:
If you do not have a database, you need to establish a database through the Create tables table name; then use show databases; View database
If the database name exists using the use database, this command can be source/root/my.sql in the database; source/root/my.sql The command is to import a data file named My.sql into the database but /root/This is the path of the MySQL file stored on Linux, according to its own fill
Method Two:
/usr/local/mysql/bin/mysql-u root-p database name </root/test.sql;
/usr/local/mysql/bin/mysql-u root-p the database name to which database you want to import < The database file to import, such as command:/usr/local/mysql/bin/mysql-u root-p Daobidao </root/test.sql Import the database file Test.sql file into the Daobidao database; (but which database needs to be imported to)
Iv. MySQL export data and table structure of the database
Export Data and table structure of a database
/usr/local/mysql/bin/mysqldump -u root -p daobidao > /root/dbd.sql
Enter password:
/usr/local/mysql/bin/mysqldump-u root-p need to export the database > export the stored database file name; for example, command:/usr/local/mysql/bin/mysqldump-u root-p D Aobidao >/root/dbd.sql will export the Daobidao database and store it in the/root/dbd.sql file. Export the table structure of a database
/usr/local/mysql/bin/mysqldump -u root -p -d daobidao > /root/dbd.sql
Enter password:
/usr/local/mysql/bin/mysqldump-u Root-p-D need to export the database > export the stored database file name; for example, command:/usr/local/mysql/bin/mysqldump-u root- p-d Daobidao >/root/dbd.sql will daobidao the database export table structure, stored in the/root/dbd.sql file.
error ip:xxx.xxx.xxx.xx connection to remote MySQL server via local connection to remote database
This is because I have a problem with the root authority of MySQL on my portal line, and I use it to modify root permissions by command .
go to MySQL and then the root directory there is a MySQL below a user and then enter the user to perform the modified command update user set host= '% ' where user = ' root '; change root permissions to all to solve the problem /c1>
Linux operation MySQL Database create library import, delete table