Linux is installed on MySQL - 12 MySql commands.

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

To install MySQL database from zero: in accordance with the order of execution :

A. check whether installed MySQL:yum installed list mysql*, If you have to uninstall, and then in the installation;

B. to install the MySQL client:yum -y install mysql;

The installation of C. MySQL server :yum -y install mysql_server;

d. Install the MySQL Library Development :yum -y install mysql-devel;

e. Configure the MySQL configuration file : Set the UTF-8 code :vim /etc/my.cnf , Add todefault-character-set=utf8;

f. Start the MySQL database :service mysqld start;

g. Create a root password : mysqladmin -u root password 000000;

h. Access to the database:mysql -u root -p Then prompted to enter a password, enter the password to enter;

i. The use of MySQL database :>use mysql

j. Delete the anonymous account :>delete from user where USER = '';

k. Refresh the permissions :>flush privileges;

l. Exit MySQL :>\q;

After installation, and can normally use;

A MySQL installation.

1 check that MySQL is installed

Execution yum list installed mysql*, This command meansCheck there is no package name contains the MySQL package;

But the following tips :

Appear Another app is currently holding the yun lock; waiting for it to exit ...

Reasons for the above tip is Yum has launched, But in the block,Yum is a single process, but at the same time to execute a command, So we want to execute other commands must be closed, this process;

Method to close the process: enter the var/run/ delete the file: this file is only one port number 5404 ;

Delete this to stop the yum process: Execution rm -f /var/run/ Commands

After the execution yum list installed mysql*Check whether installed MySQL related software: this time shows the result we want, MySQL related files are not installed.

The use of RMP -qa | grep mysql* command can also see if the installation of MySQL :

That, MySQL is not installed, while Tomcat is not installed;

2 shows the yum install MySQL version

Execution yum list|grep mysql Command, can display the MySQL version, there is no view the yum source in the MySQL installation package;

Installing MySQL 3

Execution yum -y install mysql Command, install the MySQL software;

Install the MySQL success !!!

Install mysql-server: Execution yum -y install mysql-server Command :

Install mysql-devel: Execution yum -y install mysql-devel Command :

Mysql-devel installed;

The 4 configuration MySQL configuration file

Execution vim /etc/my.cnf Command, edit this file :

Set the MySQL character encoding for UTF-8;

Add in /ect/my.cnf: default-character-set=utf8

Two. Start stop MySQL

1 start MySQL

Method: use service mysqld mysqlYou can start MySQL;Note that the middle is mysqld, not mysql, followed by a D;

Method two: use /etc/init.d/mysqld startCommand, also can open the database.

The 2 stop MySQL database

Use service mysqld stopCommand, can stop the database.

Three MySQL database operation

1 on the MySQL database

Modify the root account password : mysqladmin -u root password 000000;

Use the command : mysql -u root@localhost Land :

Use the quit command to quit MySQL;

2 solve cannot create database problem (anonymous account login)

Display the existing database: > show databases; command to display database, attention back to take good;

Create database, can appear the following conditions :

The reason is because the anonymous account MySQL user table, while using the root landing, but still as anonymous accounts, we need to remove these anonymous accounts :

In a terminal :

Use the service MySQL stop command to shut down mysql, and then use the mysqld_safe --skip-grant-table command shielding permissions :

In the terminal 2: open a new terminal, and the terminal does not close, keep the above state :

Use the MySQL -u root MySQL command,

Connect to the database and create the database :

3 the forgot password operation

First, stop the MySQL service in a terminal, then the user permissions screen MySQL;

Enter the mysql, modify the root password :

4 how to modify the password

5 MySQL database location

The MySQL database is stored in the /var/lib/mysql/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Eilian at December 17, 2013 - 11:55 AM