How to configure the MySQL database in Linux

Source: Internet
Author: User

The following article describes how to install and configure a MySQL database in a Linux operating system. We all know that many websites currently use Linux + MySql. Installing and configuring MySql in Windows is simple.

But it is a little troublesome to install it in Linux. For Linux beginners who are familiar with Windows, it is really "quite" troublesome!

Follow these steps to install MySql in Red Hat Enterprise Linux AS 4.0:

Download MySQL:

Download Red Hat Enterprise Linux 4 RPM (x86): MySQL-server-standard-5.0.27-0.rhel4.i386.rpm

Install MySQL:

 
 
  1. rpm -ivh MySQL-server-standard-5.0.27-0.rhel4.i386.rpm --nodeps --force 

Modify/etc/my. cnf as needed. Refer to configuring MySQL:

 
 
  1. [mysqld] 

The default setting is an INNODB table, which supports transactions and row locks:

 
 
  1. default-storage-engine=INNODB 

Set the default character set:

 
 
  1. default-character-set=utf8 

Maximum buffer size used for client communication

 
 
  1. max_allowed_packet=16M 

Start MySQL:

 
 
  1. service mysql start  
  2. /etc/init.d/mysql start  
  3. /usr/share/mysql/mysql.server start 

[Mysql. server]

# Comment out the basedir line; otherwise, MySql may not be able to start

# It is said to be a MySql bug

 
 
  1. # basedir=/var/lib 

Enable MySQL to start automatically when the MySql system is started: Check MySQL in system Settings> Server Settings> service.

When the root user logs on, mysql is automatically started:

Add one line to the/root/. bash_profile file:

 
 
  1. /usr/share/mysql/mysql.server start 

View the startup log:

 
 
  1. /var/log/messages 

Show all MySQL users:

 
 
  1. use mysql;  
  2. select host,user,password from user; 

Add a MySQL user (user name: user1, password: SQL ):

 
 
  1. grant all on *.* to user1@'%' identified by 'sql' with grant option; 

Delete a MySQL user:

 
 
  1. delete from user where user='user1'; 

The above content is an introduction to installing and configuring MySQL in Linux. I hope you will have some gains.

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.