MySQL (a) MySQL installation in Linux system

Source: Internet
Author: User

Introduction


Now because the project needs to build MySQL cluster, from the simplest start, first install a MySQL under Linux system.


steps:


First step: Install:


Tar mysql-5.5.48-linux2.-x86_64.tar.gz


Copy to the specified path:


CP mysql-5.5.48-linux2.6-x86_64 /usr/local/mysql-r



Add system mysql combo MySQL User:


Execute command: Groupaddmysql and Useradd-r-G MySQL MySQL



To install the database:


Go to install MySQL software directory: Execute command cd/usr/local/mysql

Modify current directory owner for MySQL User: Execute command chown-r mysql:mysql./

Install Database: Execute command ./scripts/mysql_install_db--user=mysql

Modify the current directory owner as root User: Execute command chown-r root:root./

Modify the current data directory owner for MySQL User: Execute command chown-r mysql:mysql Data

To this database installation is complete




Start the MySQL service and add the boot MySQL service:

Add Boot: Execute command cpsupport-files/mysql.server/etc/init.d/mysql, put startup script on boot initialization directory

Start MySQL service: Execute command servicemysql start




Step Two: How to configure MySQL:


Look at our MySQL whether to start successfully:

Input: PS -ef | grep mysql



To modify the root user password of MySQL, the root initial password is empty:

Execute command:./bin/mysqladmin-u root-h localhost.localdomain password ' password '



Put the MySQL client on the default path:

Ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql



Note:


When starting the client, the report:

Can ' t connect tolocal MySQL server through socket '/tmp/mysql.sock ' (2)


Workaround:


question, and then we looked at our /etc/my.cnf:


<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" >[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# Disabling Symbolic-links is Recommended to prevent assorted security riskssymbolic-links=0[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/ Var/run/mysqld/mysqld.pid</span>

Solution:


Socket in the /var/lib/mysql/mysql.sock path, this time we need to be as linked to Mysql.sock to the Tmp/mysql.sock you can do it in the middle.


Note: In fact, this problem is very obvious, we look at the socket parameters, in/var/lib/mysql/mysql.sock, and the TCP protocol to find the address of tmp/mysql.sock, so, we otherwise sauce above the sockket=/tmp/ Mysql.sock. Of course we all know, in fact, we just need to soft connected to the Tmp/mysql.sock.


The approach we use:



In addition we solve the problem that Windows system is not connected to MySQL on Linux system:



In this way, we actually, all of our login to MySQL, are in MySQL library in MySQL in the user table in the login, this table in our Windows connection, this is the ' [email protected] ', for a simple example, If my computer's IP is ' 192.168.22.28 ', then I send the connection, that is, ' [email protected] ', so, we at the time of modification, the host is '% ', representing all the connected clients, this time, We just need to make a change to this password.


However, when I was connected in my navicat, I found that I could not link, then I will check to see if it is not the wrong password, we look at the user table again:





We can see that the password we modified above is localhost for ' 123456 ' (here are all encrypted with MD5), but we use the '% ', this time, found two different passwords, this time, we need to look at what the password is, of course, I guess a bit, Should be root, therefore, I put navicat link password as ' root ', found to link up ...


You may also have problems like this:



This is the Telnet connection MySQL, there is garbled add h_mysql_native_passowrd problem, this time, do not control it can. Nothing to affect.


Conclusion:


When we are doing something, we need to think while learning, in order to make efficiency faster!











MySQL (a) MySQL installation in Linux system

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.