CentOS6.5 installation configuration MySQL

Source: Internet
Author: User

RPM Mode installation MySQL5.6

A. Check MySQL and related RPM packages, if installed, remove (rpm–e name)

1 [[Email protected] ~]# Rpm-qa | Grep-i mysql2 mysql-libs-5.1.66-2.el6_3.x86_643 [[email protected] ~]# yum-y Remove mysql-libs*

b. Download the corresponding RPM package for Linux, such as: centos6.4_64 corresponding RPM package, as follows:

1 [[Email protected] rpm]# ll2 total 743643-rw-r--r--. 1 root root 18442536 Dec 20:19 mysql-client-5.6.15-1.el6.x86_64.rpm4-rw-r--r--. 1 root root  3340660 Dec 20:06 mysql-devel-5.6.15-1.el6.x86_64.rpm5-rw-r--r--. 1 root root 54360600 Dec 20:03 My sql-server-5.6.15-1.el6.x86_64.rpm

C. Install MySQL

1 [[Email protected] rpm]# RPM-IVH mysql-server-5.6.15-1.el6.x86_64.rpm2 [[email protected] rpm]# RPM-IVH mysql-devel-5. 6.15-1.EL6.X86_64.RPM3 [[email protected] rpm]# RPM-IVH mysql-client-5.6.15-1.el6.x86_64.rpm4 #修改配置文件位置5 [[Email Protected] rpm]# CP/USR/SHARE/MYSQL/MY-DEFAULT.CNF/ETC/MY.CNF

D. Initializing MySQL and setting passwords

1 [[Email protected] rpm]#/USR/BIN/MYSQL_INSTALL_DB2 [r[email protected] rpm]# service MySQL start3 [[email protected] RP m]# Cat/root/.mysql_secret  #查看root账号密码4 # The random password set for the root user at Wed Dec all 23:32:50 (loca L time): qKTaFZnl5 [[email protected] ~]# mysql-uroot–pqktafznl6 mysql> SET PASSWORD = PASSWORD (' 123456 ');    #设置密码为1234567 mysql> exit8 [[email protected] ~]# mysql-uroot-p123456

E. Allow remote login

1 mysql> use MySQL; 2 mysql> Select Host,user,password from user; 3 +-----------------------+------+-------------------------------------------+ 4 | Host                  | user | password                                  | 5 +-----------------------+------+-------------------------------------------+ 6 | localhost |             root | *6bb4837eb74329105ee4568dda7dc67ed2ca2ad9 | 7 | localhost.localdomain | root | *1237e2ce819c427b0d 8174456dd83c47480d37e8 | 8 | 127.0.0.1             | root | *1237e2ce819c427b0d8174456dd83c47480d37e8 | 9 |:: 1                   | root | * 1237e2ce819c427b0d8174456dd83c47480d37e8 |10 +-----------------------+------+----------------------------------- --------+11  mysql> Update user set Password=password (' 123456 ') where user= ' root '; mysql> update user set Ho st= '% ' where user= ' root ' and host= ' localhost '; mysql> flush privileges;15 mysql> exit

F. Setting up boot from

1 [[Email protected] ~]# chkconfig mysql on2 [[email protected] ~]# Chkconfig--list | grep mysql3 mysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off

MySQL Access denied for user[email protected]

Cause 1-Startup command error:
I started by typing the command directly: MySQL start
The correct startup command is:
/etc/rc.d/init.d/mysql start

Cause 2-Configuration file Error:
Check etc below the MY.CNF below:

[Client]

#password   = Your_passwordport =     3306socket     =/usr/mysql-data/mysql.sock# Here follows entries for some Specific programs# the MySQL server[mysqld]port     = 3306socket     =/usr/mysql-data/mysql.sock

Cause 3-Startup file error:
Need to modify MySQL startup script/etc/rc.d/init.d/mysql,
where datadir=? Check the line!

Cause 4-If you have an error when using PHP connection!
In/etc/php.ini, modify the value of the Mysql.default_socket setting to:
Mysql.default_socket=/var/lib/mysql/mysql.sock
Back to finish setting up a connection: Ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
(in/etc/php.ini mysql.default_socket this file, the description of the value of Mysql.default_socket is this,
;D efault socket name for local MySQL connects. If empty, uses the built-in MySQL defaults.
This value is empty at first, that is, PHP will use the default value built in MySQL if we do not take the initiative to modify it.


Note: You also encounter the need to service MySQL star in order to start service MySQL stop to stop.
There is also the direct use of MySQL can not find the command, the error is "Bash:mysql:command not found" can be directly **mysql the Bin folder in the installation directory with the absolute path to run commands, and some need to add./mysql to execute.

There are several ways to change the password in MySQL

Method One

Using phpMyAdmin

(graphical management of MySQL database Tools), this is the simplest, directly with the SQL statement to modify the MySQL Database Library user table, but do not forget to use the password function, insert the user with the Insert command, modify the user with the update command, delete with delete command. A detailed description of the data table User field is later in this section.

Method Two

Use Mysqladmin. Input

Mysqladmin-u root-p OldPassword newpasswd

After executing this command, you need to enter the root's original password so that the root password will be changed to NEWPASSWD. Similarly, you can change your password by changing the root of the command to your username.

Of course, if your mysqladmin isn't connected to MySQL,

Server, or you have no way to execute mysqladmin, then this method is invalid, and mysqladmin cannot erase the password.

The following methods are used at the MySQL prompt and must have root privileges for MySQL:

Method Three

Mysql> INSERT into Mysql.user (Host,user,password) VALUES ('% ', ' system ', Password (' manager '));

Mysql> FLUSH Privileges

Specifically, this is the addition of a user named system with a password of manager. Note To use the password function, and then use the flush

Privileges to perform the confirmation.

CentOS6.5 installation configuration mysql (RPM)

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.