Linux CentOS install MySQL (Unzip manual install)

Source: Internet
Author: User
Tags deprecated mysql login ssl connection

System version:

[Email protected] ~]# uname-r

2.6.32-358.el6.i686

[Email protected] ~]# cat/etc/issue

CentOS Release 6.4 (Final)

Kernel \ r on an \m

Download the Linux generic 32bit mysql package (http://dev.mysql.com/downloads/mysql/).

Step Start:

1, directly wget download, or download and upload to the server side.


2, unzip.


3, copy the extracted MySQL directory to/usr/local/mysql and create a new data directory under it.


4, new user MySQL and user group MySQL, and the MySQL directory for permission modification.

[[email protected] local] # pwd

/usr/local

[[email protected] local] # chown-r Mysql:mysql mysql/

[[email protected] MySQL] # ll

Total 56

Drwxr-xr-x. 2 MySQL mysql 4096 June 01:42 bin

-rw-r--r--. 1 MySQL MySQL 17987 June 01:42 COPYING

Drwxr-xr-x. 5 MySQL mysql 4096 June 04:40 data

Drwxr-xr-x. 2 MySQL mysql 4096 June 01:42 docs

Drwxr-xr-x. 3 MySQL mysql 4096 June 01:42 include

Drwxr-xr-x. 5 MySQL MySQL 4096 June 01:43 Lib

Drwxr-xr-x. 4 MySQL mysql 4096 June 01:42 man

-rw-r--r--. 1 MySQL MySQL 2478 June 01:39 README

Drwxr-xr-x. MySQL MySQL 4096 June 01:42 share

Drwxr-xr-x. 2 MySQL mysql 4096 June 01:43 Support-files

[Email protected] mysql]#

[[email protected] MySQL] # pwd

/usr/local/mysql


5. Initialize the data.

[[email protected] MySQL] #./bin/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/mysql/data/

[Email protected] mysql]#


6. Copy the configuration file.

[Email protected] mysql]# cp-a./support-files/my-default.cnf/etc/my.cnf

[Email protected] mysql]#


7, place the MySQL service script in the/etc/init.d/directory.

[Email protected] mysql]# cp-a./support-files/mysql.server/etc/init.d/mysqld

[Email protected] mysql]#


8. Start the service.

[[email protected] MySQL] # service Mysqld Restart

Shutting down MySQL. success!

Starting MySQL. success!

[Email protected] mysql]#


9. Check the initial password and log in to MySQL.

[[email protected] MySQL] # Cat/root/.mysql_secret

# Password set for user ' [e-mail protected] ' at 2016-06-26 02:48:47

: Jidfmi%5kak

[[email protected] MySQL] #./bin/mysql-uroot-p

Enter Password: (enter the above password here)

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 3

Server version:5.7.13


Copyright (c), Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of the Oracle Corporation and/or its

Affiliates. Other names trademarks of their respective

Owners.


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


Mysql>

Mysql> status (there will be an error below, prompted to change the password before executing the command)

ERROR 1820 (HY000): Must reset your password using ALTER USER statement before executing this statement.

Mysql>


10. Modify the MySQL login password.

[[email protected] MySQL] #./bin/mysqladmin-uroot-p Password

Enter Password: (enter the old password above)

New Password:

Confirm New Password:

Warning:since password is sent to server in plain text, use SSL connection to ensure password safety.

[Email protected] mysql]#


11. Log in to MySQL using the new password.

[[email protected] MySQL] #./bin/mysql-uroot-p

Enter Password: (New password)

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 8

Server version:5.7.13 MySQL Community Server (GPL)


Copyright (c), Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of the Oracle Corporation and/or its

Affiliates. Other names trademarks of their respective

Owners.


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


mysql> Select version ();

+-----------+

| Version () |

+-----------+

| 5.7.13 |

+-----------+

1 row in Set (0.01 sec)


Mysql>


12, the MySQL installation is complete.


Error Resolution:

1,

[[email protected] mysql-5.7.13] #./bin/mysql_install_db--user=mysql

2016-06-26 02:47:09 [WARNING] mysql_install_db is deprecated. Consider switching to mysqld--initialize

2016-06-26 02:47:09 [ERROR] The data directory needs to be specified.


WORKAROUND: You need to create a new data directory, specify the installation directory (you need to specify the default path when you are not in the default directory:/usr/local/mysql, and you need to specify./support-files/ Basedir and DataDir in Mysql.server are the corresponding paths).

[[email protected] mysql-5.7.13] #./bin/mysql_install_db--user=mysql--basedir=/usr/local/mysql-5.7.13/--datadir=/usr/local/mysql-5.7.13/ data/

2016-06-26 02:48:47 [WARNING] mysql_install_db is deprecated. Consider switching to mysqld--initialize

2016-06-26 02:49:19 [WARNING] The bootstrap log isn ' t empty:

2016-06-26 02:49:19 [WARNING] 2016-06-26t09:48:50.798592z 0 [WARNING]--bootstrap is deprecated. Please consider using--initialize instead

2016-06-26t09:48:50.898732z 0 [Warning] Changed limits:max_open_files:1024 (requested 5000)

2016-06-26t09:48:50.898778z 0 [Warning] Changed limits:table_open_cache:431 (requested 2000)

A custom path is not specified in Mysql.server because of an escalation error.


2, starting the MySQL service is unsuccessful.

[[Email protected] ~] #/etc/init.d/mysqld Start

/etc/init.d/mysqld:line 256:my_print_defaults:command not found

Starting MySQL error! Couldn ' t find MySQL server (/usr/local/mysql/bin/mysqld_safe)

Resolution: The original default path is the/usr/local/mysql directory, where the directory is/usr/local/mysql-5.7.13.

Change the mysql-5.7.13 to MySQL and restart, and find the following error:

error! MySQL server PID file could not being found!

Confirm that the current directory owner is root and change to MySQL:

[[email protected] local] # chown-r Mysql:mysql mysql/

[[email protected] local] #/etc/init.d/mysqld Restart

error! MySQL server PID file could not being found!

Starting MySQL ..... success!


3, the login was unsuccessful because the service did not start.

[[email protected] mysql-5.7.13] # Cat/root/.mysql_secret

# Password set for user ' [e-mail protected] ' at 2016-06-26 02:48:47

: Jidfmi%5kak

[[email protected] mysql-5.7.13] #./bin/mysql-uroot-p

Enter Password:

ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)

Workaround: This problem disappears after the 2nd problem is resolved (the MYSQLD service needs to be started).

Reference: http://www.cnblogs.com/azhw/p/5143232.html

Linux CentOS install MySQL (Unzip manual install)

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.