Linux mysql installation tutorial, linuxmysql tutorial

Source: Internet
Author: User

Linux mysql installation tutorial, linuxmysql tutorial

For MySQL on all platforms: Download MySQL. Select the MySQL Community Server version you need and the corresponding platform.

MySQL-MySQL server. You need this option unless you only want to connect to the MySQL server running on another machine.
The MySQL-client-MySQL client program is used to connect to and operate the Mysql server.
MySQL-devel-library and inclusion files. If you want to compile other MySQL clients, such as the Perl module, you need to install this RPM package.
MySQL-shared-This package contains the shared Library (libmysqlclient. so *) that needs to be dynamically loaded by some languages and applications, using MySQL.
MySQL-benchmark-MySQL database server benchmark and Performance Testing Tool

Installation steps:
The official website provides two installation packages for download, one for rpm and the other for tar. You can choose either of them.

The following describes how to install the rpm package:
Upload the downloaded file to the server and put it in a folder.
Go to the file and execute the following command:

[root@host]# rpm -i MySQL-5.0.9-0.i386.rpm

MySQL-5.0.9-0.i386.rpm is the name of the file you downloaded.

The above process creates a mysql user and creates a mysql configuration file my. cnf.
You can find all MySQL-related binary files in/usr/bin and/usr/sbin. All data tables and databases will be created in the/var/lib/mysql directory.

Tar package installation process:
Mysql

Go in and click community, and then click Mysql Community Server.
Write the image description here

Select an appropriate version as needed,
The location of 2 is the linux version of different systems. After selecting it, pull the scroll bar to the bottom and download it.

After downloading, transfer the tar package to the server.

1. Extract

# Unzip tar-zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz # copy the decompressed mysql directory cp-r mysql-5.6.33-linux-glibc2.5-x86_64/usr/local/mysql

2. Add users and user groups

# Add User Group groupadd mysql # Add User mysql to user group mysqluseradd-g mysql

3. Install

Cd/usr/local/mysql/# create a data folder mkdir. /data/mysql # modify the File Permission chown-R mysql: mysql. /# Install and specify the user and data folder location. /scripts/mysql_install_db -- user = mysql -- datadir =/usr/local/mysql/data/mysql # copy mysql to the service automatically start cp support-files/mysql. server/etc/init. d/mysqld # modify the permission to 755, that is, root can execute chmod 755/etc/init. d/mysqld # copy the configuration file to etc, because the default start first to load the configuration file cp support-files/my-default.cnf/etc/my. cnf # modify the startup script vi/etc/init. d/mysqld # modify the entry: basedir =/usr/local/mysql/datadir =/usr/local/mysql/data/mysql # start service mysqld start # test the connection. /mysql/bin/mysql-uroot # Add the environment variable and edit/etc/profile. In this way, you can run mysql Command export PATH = $ PATH anywhere: /usr/local/mysql/bin # start mysqlservice mysqld start # disable mysqlservice mysqld stop # restart mysqlservice mysqld restart # view the running status service mysqld status

4. Problem
After the installation is complete, modify the root user password and configure the relevant user.

After the connection is completed, an error is reported when you use a tool for remote connection because you have no permission for the remote connection user.

Solution 1:Change the 'host' entry in the 'mysql' database 'user' table from 'localhost' to '% '.

use mysql;select 'host' from user where user='root'; update user set host = '%' where user ='root';flush privileges;

Solution 2:Direct authorization

GRANT ALL PRIVILEGES ON *.* TO ‘root'@'%' IDENTIFIED BY ‘youpassword' WITH GRANT OPTION;

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.