# CD/USR/SRC
# TAR-ZVXF mysql-3.22.25-pc-linux-gnu-i686.tar.gz (produce mysql-3.22.25-pc-linux-gnu-i686 directory)
# CD mysql-3.22.25-pc-linux-gnu-i686
#./configure--prefix=/usr/local/mysql (where the parameters are set to install the path)
# make
# make Install
Note When running configure, set the MySQL installation destination path to/usr/local/mysql, which is also used during subsequent installation. Then, build the original database: # scripts/mysql_install_db
This command will create two databases under/usr/local/mysql/var/: MySQL and Test, the former being MySQL's Rights Management database, which is for you to do the exercise.
Note: If you have previously installed the fruit MySQL, the original database already exists, do not need to reinstall.
Finally, start MySQL:
# Cd/usr/local/mysql/bin
#./safe_mysqld &
If you want the database service to run automatically when the machine starts, you can add the startup command above to the/etc/rc.d/rc.local file.
Now that MySQL is running and waiting for your data processing command! However, be careful: You have not set a password for your root administrator, and anyone can modify your database (including the most important rights libraries) at will! Don't believe it, do the following exercises (assuming our current directory is/usr/local/mysql/bin): Try any user login and run:
$./mysql-u Root
You can immediately go to the "mysql>" client software prompt and do any data processing without requiring any password; this means that the password for the MySQL administrator "root" account and your UNIX account can be different. To add a password to the root account, execute:
#./mysqladmin-u root password ' new password '
Execute again as a general user:
$./mysql-u Root
The system prompts for a password, and if the password is incorrect, access is denied. In fact, even if you are the root user, the system rejects the same if you do not explicitly indicate the use of the password:
#./mysql-u Root
Or
#./mysql System response:
ERROR 1045:access denied for user: ' Root@localhost ' (Using password:no)
Only use the-p parameter to specify that you want to use the password, the system will prompt you to enter the password, and enter the correct password before you can enter:
#./mysql-u root-p
password:******** (Enter password)
Welcome to the MySQL Monitor. Commands End With; or G.
Your MySQL Connection ID is-to-server version:3.22.25
Type ' help ' for help.
Mysql>
Type exit to return to the shell.
Script Mysql.server (in the ' Share/mysql ' directory) for starting or stopping a MySQL server:
Shell> mysql.server Start
Shell> Mysql.server Stop
The script actually starts the server by executing safe_mysqld. Stopping a server can also be accomplished through a management program:
Mysqladmin shutdown
You can also start MySQL automatically when the system starts by adding the following command to the '/etc/rc.local ' file:
/bin/sh-c ' Cd/usr/local/mysql;/bin/safe_mysqld & '