MySQL installation detailed tutorial on Linux

Source: Internet
Author: User

MySQL for all platforms: MySQL download. Pick the version of MySQL Community Server you need and the corresponding platform.

Mysql-mysql server. You need this option unless you only want to connect to a MySQL server that is running on another machine.
Mysql-client-mysql client program for connecting and operating the MySQL server.
Mysql-devel-Libraries and include files, if you want to compile other MySQL clients, such as Perl modules, you need to install the RPM package.
Mysql-shared-The package contains some languages and applications that require dynamic loading of shared libraries (libmysqlclient.so*), using MySQL.
Benchmark and performance testing tools for the Mysql-bench-mysql database server

Installation steps:
The official website provides two kinds of installation package download, one is to let rpm, one is tar, both ways can be, please choose your own.

First introduce the steps of the RPM package installation:
Upload the downloaded file to the server and place it in a folder.
Go to the file to execute the following command:

?
1 [[email protected]]# rpm -i MySQL-5.0.9-0.i386.rpm

MYSQL-5.0.9-0.I386.RPM the name of the file you downloaded.

The process of installing the MySQL server above will create a MySQL user and create a MySQL profile my.cnf.
You can find all of the MySQL-related binaries 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, then click MySQL Community Server
Write a picture description here

1 in the previous version, select the appropriate version as needed,
The 2 location is the Linux version under different systems, and the scroll bar is pulled to the bottom to download.

Once downloaded, transfer the TAR package to the server.

1. Unzip

?
1234 #解压tar-zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz#复制解压后的mysql目录cp-r mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql

2. Adding users and user groups

?
1234 #添加用户组groupadd mysql#添加用户mysql 到用户组mysqluseradd-g mysql mysql

3. Installation

?
123456789101112131415161718192021222324252627282930313233343536373839 cd /usr/local/mysql/#创建数据文件夹mkdir ./data/mysql#修改文件权限chown -R mysql:mysql ./#安装并指定用户和data文件夹位置./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql#复制mysql到服务自动启动里面cp support-files/mysql.server /etc/init.d/mysqld#修改权限为755 也就是root可以执行chmod 755 /etc/init.d/mysqld#复制配置文件到etc下,因为默认启动先去etc下加载配置文件cp support-files/my-default.cnf /etc/my.cnf#修改启动脚本vi /etc/init.d/mysqld#修改项:basedir=/usr/local/mysql/datadir=/usr/local/mysql/data/mysql#启动服务service mysqld start#测试连接./mysql/bin/mysql -uroot#加入环境变量,编辑 /etc/profile,这样可以在任何地方用mysql命令了export PATH=$PATH:/usr/local/mysql/bin#启动mysqlservice mysqld start#关闭mysqlservice mysqld stop#重新启动mysqlservice mysqld restart#查看运行状态service mysqld status

4. Questions
After the installation is complete, the root user password modification and related user configuration.

After the completion of the remote connection with the tool error, because there is no user rights to the remote connection problem.

Resolution 1: change the ' MySQL ' database ' user ' table ' host ' entry from ' localhost ' to '% '.

?
1234 use mysql;select‘host‘ from user where user=‘root‘; update user set host = ‘%‘where user =‘root‘;flush privileges;

Resolution 2: Direct authorization

?
1 GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘youpassword‘WITH GRA

MySQL installation detailed tutorial on Linux

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.