Important directories of Linux MySQL
1. Database directory
/Var/lib/mysql/
2. Configuration File
/Usr/share/mysql (mysql. server command and configuration file)
3. Related commands
/Usr/bin (commands such as mysqladmin mysqldump)
4. Start the script
/Etc/rc. d/init. d/(directory for starting the script file mysql)
Changing the logon password for Linux MySQL
Linux MySQL does not have a password by default. It is self-evident that the password is added after installation.
1. Commands
Usr/bin/mysqladmin-u root password 'new-password'
Format: mysqladmin-u username-p old password New password
2. Example
Example 1: Add a 123456 password to the root user.
Type the following command:
[Root@www.bkjia.com local] #/usr/bin/mysqladmin-u root password123456
Note: because the root account does not have a password at the beginning, the old-p password can be omitted.
3. test whether the modification is successful
1) login without a password
[Root@www.bkjia.com local] # mysql
ERROR 1045: Access denied for user: 'root @ localhost' (Usingpassword: NO)
An error is displayed, indicating that the password has been modified.
2) log on with the modified Password
[Root@www.bkjia.com local] # mysql-u root-p
Enter password: (Enter the password 123456 after modification)
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 4 to server version: 4.0.16-standard
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Mysql>
Successful! You can use the mysqladmin command to change the password or the database to change the password.
Linux MySQL Start and Stop
1. Start
After MySQL is installed, run the following command to start mysql in the/etc/init. d directory.
[Root@www.bkjia.com init. d] #/etc/init. d/mysql start another installer installs MySQL as a service, so you can use # service mysql start to start LinuxMySQL in any directory.
2. Stop
/Usr/bin/mysqladmin-u root-p shutdown or: # service mysqlstop
3. Automatic Start
1) Check whether mysql is in the Auto Start List
[Root@www.bkjia.com local] #/sbin/chkconfig-list
2) Add Linux MySQL to the startup Service Group of your system.
[Root@www.bkjia.com local] #/sbin/chkconfig-add mysql
3) Delete Linux MySQL from the startup Service Group.
[Root@www.bkjia.com local] #/sbin/chkconfig-del mysql