Install MySQL in Ubuntu: 1. Install sudoapt-getinstallmysql-server on the Internet. Example. 3. Binary Package installation: environment variables have been automatically configured after installation. You can directly use the mysql Command Network
Install MySQL in Ubuntu in three ways:
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.
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 installing the MySQL offline package under Ubuntu.
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'
Configure and manage msyql:
1. Modify mysql Max connections: cp support-files/my-medium.cnf./my. cnf, vim my. cnf, add or modify max_connections = 1024
For my. cnf: mysql, search for my. cnf:/etc, mysql installation directory, and data under installation directory. /Etc is set globally.
2. Start mysql:/usr/local/mysql/bin/mysqld_safe -- user = mysql &
3. Stop mysql: mysqladmin-uroot-ppassw0rd shutdown. Note that there is no space after u or p.
4. Set mysql auto-start: add the startup command to the/etc/rc. local file.
5. Allow remote root login:
1) log on to mysql on the local machine: mysql-u root-p (-p must be available); change the database: use mysql;
2) from all hosts: grant all privileges on *. * to root @ "%" identified by "passw0rd" with grant option;
3) grant all privileges on *. * to root @ "192.168.11.205" identified by "passw0rd" with grant option; flush privileges;
4) Go to the mysql database to check whether the data with host % is added: use mysql; select * from user;
6. Create a database and create a user:
1) database creation: create database test1;
2) create a user and grant permissions: grant all privileges on test1. * to user_test @ "%" identified by "passw0rd" with grant option;
3) delete a database: drop database test1;