Three installation methods:
1. install sudo apt-get install mysql-server from the Internet. After the environment variables have been automatically configured, you can directly use the mysql command.
Note: We recommend that you change cn in/etc/apt/source. list to us, and the servers in the United States are much faster than those in China.
2. Install the release package. Take mysql-5.0.45-linux-i686-icc-glibc23.tar.gz as an example.
3. Binary package installation: environment variables have been automatically configured after installation. You can directly use the mysql command
Online installation and binary package installation are relatively simple, with emphasis on the installation of offline packages.
The code is as follows: |
Copy code |
1. groupadd mysql 2. mkdir/home/mysql 3. useradd-g mysql-d/home/mysql 4. copy the mysql-5.0.45-linux-i686-icc-glibc23.tar.gz to the/usr/local directory 5. Unzip the tar zxvf mysql-5.0.45-linux-i686-icc-glibc23.tar.gz 6. ln-s mysql-5.0.45-linux-i686-icc-glibc23 mysql 7. cd/usr/local/mysql 8. chown-R mysql. 9. chgrp-R mysql. 10. scripts/mysql_install_db -- user = mysql (be sure to run the command in the mysql Directory. Note that the output text contains the command to change the root password and start mysql) 11. Set the password for root:./bin/mysqladmin-u root password 'passw0rd' |
Uninstalling mysql from ubuntu
Delete mysql
The code is as follows: |
Copy code |
1. sudo apt-get autoremove -- purge mysql-server-5.5 2. sudo apt-get remove mysql-common |
Clean residual data
The code is as follows: |
Copy code |
Dpkg-l | grep ^ rc | awk '{print $2}' | sudo xargs dpkg-P |