Linux system installation MySQL steps and support remote operation configuration method

Source: Internet
Author: User
Tags mysql login

First, the database installation (installed in the/usr/local directory)

1. Compress package Copy to/users/lengyufang/tools

2. Groupadd MySQL
3. Useradd-r-G mysql-s/bin/false MySQL
4. cd/usr/local
5. Tar zxvf/users/lengyufang/tools/mysql-5.5.48-linux2.6-x86_64.tar.gz
6. Ln-s mysql-5.5.48-linux2.6-x86_64 MySQL
7. CD MySQL
8. chown-r MySQL.
9. chgrp-r MySQL.
Ten. scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data
One. Chown-r root.
Chown-r MySQL Data
CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
Bin/mysqld_safe--USER=MYSQL1 &
Ln-s/usr/local/mysql/bin/mysql/usr/bin
Ln-s/usr/local/mysql-5.5.48-linux2.6-x86_64/bin/mysqladmin/usr/bin

The following steps are installed in the/users/mysql directory

2. Groupadd MySQL
3. Useradd-r-G mysql-s/bin/false MySQL
4. Cd/users/mysql
5. Tar zxvf/users/lengyufang/tools/mysql-5.5.48-linux2.6-x86_64.tar.gz
6. Ln-s mysql-5.5.48-linux2.6-x86_64 MySQL
7. CD MySQL
8. chown-r MySQL.
9. chgrp-r MySQL.
Ten. scripts/mysql_install_db--user=mysql--basedir=/users/mysql/mysql--datadir=/users/mysql/mysql/data
One. Chown-r root.
Chown-r MySQL Data
CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
Bin/mysqld_safe--user=mysql &
Ln-s/users/mysql/mysql/bin/mysql/usr/bin
Ln-s/users/mysql/mysql-5.5.48-linux2.6-x86_64/bin/mysqladmin/usr/bin

Second, set the database login password

Default after installation, login MySQL without password

[[email protected] ~]$ MySQL
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 2
Server Version:5.5.48-log MySQL Community Server (GPL)

Copyright (c), Oracle and/or its affiliates. All rights reserved.
This software comes with absolutely NO WARRANTY. This is the free software,
And you is welcome to modify and redistribute it under the GPL v2 license

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>

To ensure security, the importance of setting the MySQL login password is self-evident. Here's how:

Execute under Shell:


/usr/bin/mysqladmin-u Root Password 123456 #密码是123456

[[email protected] local]# MySQL
ERROR 1045:access denied for user: ' [email protected] ' (Using password:no)
An error is displayed stating that the password has been modified.

Third, the database supports remote access settings
1, Mysql-u Root-p
Then enter the password

2, use MySQL;

3. Grant all privileges on * * to [e-mail protected] "%" identified by "123456";

Iv. remote access to the database

Mysql-h 10.43.114.4-u root-p 123456 db_code_cover-e "select * from Tbl_code_cover"

#db_code_cover是数据库名, Tbl_code_cover is the data sheet under Db_code_cover.

Note that the syntax above is a way to execute MySQL statements under the shell.

Anyone familiar with MySQL knows that select * from Tbl_code_cover is a standard execution statement in a MySQL environment.


V. Viewing the storage directory for database data

1, Mysql-u Root-p
Then enter the password

2, show variables like ' datadir% ';

MySQL [db_code_cover]> Show variables like ' datadir% ';
+---------------+--------------------------+
| variable_name | Value |
+---------------+--------------------------+
| DataDir | /users/mysql/mysql/data/|
+---------------+--------------------------+

1 row in Set (0.00 sec)

Value indicates the location of the data file is/users/mysql/mysql/data/

Note that the 10th step in step one scripts/mysql_install_db--user=mysql--basedir=/users/mysql/mysql--datadir=/users/mysql/mysql/data

The database file location is specified.

Linux system installation MySQL steps and support remote operation configuration method

Related Article

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.