Linux database system MySQL application overview _ MySQL

Source: Internet
Author: User
Tags mysql tutorial
The essence of establishing a database is to make it cost-effective while having excellent performance. First, we choose an open Linux operating system. at the same time, there are too many database systems that can be applied in Linux, such as Oracle Oracle8i, Sybase-ASEforLinux, PostgreSQL, and MySQL. This article focuses on the Linux-based database management of MySQL. the essence of database establishment is that it is cheap and requires excellent performance. First, we choose an open Linux operating system. at the same time, there are too many database systems that can be applied in Linux, such as Oracle 8i, Sybase-ASE for Linux, PostgreSQL, and MySQL. This article describes MySQL-based Linux database management and applications.
  
   I. MySQL overview.
  
It can be said that this is the preferred free database system for the Linux platform of the small and medium-sized enterprise website. It is a cross-platform database system, a real
Multi-user, multi-thread SQL database system, and a distributed database management system with a client/server architecture. At the same time, it is also the most simple database system used in Linux. it is easy to install, use, and manage, and the stability of the database system is also very good.
  
   II. install MySQL.
  
The latest version can be obtained from the http://www.mysql.com. It is similar to the installation of server software in all Linux systems.
There are two types: RPM software package and source code form. Depending on your installation source, the methods are naturally different. Note that both installation steps should be logged on as Root.
  
1. RPM software package.
RPM software package minimum installation: rpm-I MySQL-VERSION.i386.rpm MySQL-client-VERSION.i386.rpm
If you only install the client: rpm-I MySQL-client-VERSION.i386.rpm
Through the above installation, RPM stores the data in the "/var/lib/mysql" file, and also in "/etc/rc. d/"to automatically start the server during boot.
  
2. source code.
Unzip it first: tar-zxvf/tmp/mysql-3.22.21-pc-linux-gnu-i686.tar.gz
./Configure--check related configuration and create configuration
Make
Make install--compile and install
  
   3. configure MySQL.
  
After MySQL is installed, it automatically generates two databases. One is used to manage user, host, and Server Database permissions. The other is test database ).
  
1. create an initialized MySQL database (also known as creating an authorized database table in some places ). Go to the MySQL installation directory and enter the following command. If no error information is displayed, it means OK:
Scripts/mysql_install_db
Exit
  
2. start the server:. // mysql/bin/safe_mysqld &
  
3. create a mysql User, for example, useradd-c "MySQL Administrator"-d/opt/mysql-g users mysql
  
4. the installation tree is assigned to the mysql User, for example, chown-R msql. users/opt/msql.
  
   4. test MySQL.
  
After the above steps, the database should be ready for normal use, and we can perform some benchmark tests on it. MySQL has a simple database example test, and its internal database keeps monitoring of permissions and accounts, so you can run mysql first to see if it can work.
  
1. if The RPM software package is installed, most programs are installed in/usr/local/mysql/bin. After running the mysql client program in this directory, if "Welcome to the MySQL monitor..." appears ..... "And other information, indicating that MySQL has been successfully started.
  
2. use the show databases command to list the installed databases.
  
If you can see the relevant information in the above two steps, it means that MySQL can work properly. EXIT MySQL command: EXIT.
  
   5. common command instances
  
1. connect to MYSQL
For example, we want to connect to MYSQL on the remote host and assume that the IP address of the remote host is 22.33.44.55, the user name is root, and the password is 1234567. the command format is mysql-h22.33.44.55-uroot-p1234567.
If you are connecting to MYSQL on the local machine, enter the mysqlbin Directory, type mysql-uroot-p, and then prompt you to enter the password. after you enter the correct password, you can enter MYSQL.
  
2. add new users
Add a user password of 1234567 so that the user can only log on to localhost (local host, that is, the host where the MYSQL database is located, you can query, insert, modify, and delete a database named mydb: grant select, insert, update, and delete on mydb. * to user @ localhost identified by "1234567 ";
  
3. display the database list: show databases
MySQL has two databases: mysql and test. For example, the above step "add a new user" is to operate the mysql database.
  
4. back up the database
Enter the mysqlbin directory and enter mysqldump -- opt system> backupsys. bbb (back up the database system to a text file named backup sys. bbb)
  
There are many other database operation commands, such as clearing the table record delete from and displaying the table structure describe table name. for details, refer to the MySQL tutorial.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.