Now because the project needs to build MySQL cluster, from the simplest start, install a MySQL in the Linux system.
First Step: Install:
Copy to the specified path:
Add system mysql combination mysql User:
Execute command: Groupaddmysql and Useradd-r-G MySQL MySQL
To install the database:
Access 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 current directory owner to root: Execute command chown-r root:root./
Modify Current Data directory owner for MySQL User: Execute command chown-r mysql:mysql data
Install to this database complete
Start MySQL service and add boot to boot MySQL service:
Add boot up: Execute command cpsupport-files/mysql.server/etc/init.d/mysql, put startup script into boot directory
Start the MySQL service: Execute command servicemysql start
Step two: How to configure MySQL:
See if our MySQL has started successfully:
Input: Ps-ef | grep MySQL
To modify the root password for 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:
When you start the client, report:
Can ' t connect tolocal MySQL server through socket '/tmp/mysql.sock ' (2)
Question, and then looked at our,/etc/my.cnf:
[Mysqld] Datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # disabling Symbolic-links is Recommended to prevent assorted security risks symbolic-links=0 [Mysqld_safe] log-error=/var/log/ Mysqld.log Pid-file=/var/run/mysqld/mysqld.pid
Socket in the/var/lib/mysql/mysql.sock path, this time, we need to be such as link to mysql.sock into the tmp/mysql.sock can be.
Note: In fact, this problem is very obvious, we look at the parameters of the socket, in the/var/lib/mysql/mysql.sock, and TCP protocol to find the address for tmp/mysql.sock, so, we otherwise sauce above the sockket=/tmp/ Mysql.sock. Of course, we all know, in fact, we only need to soft connect to the Tmp/mysql.sock can be.
The approach we use:
In addition, we solve the Windows system is not connected to the Linux system MySQL problem:
This way, we actually, all of our landing on MySQL, are in MySQL in the MySQL library in the user table in the login, this table in our Windows connection, is such a ' user@host ', for example, if my computer's IP is ' 192.168.22.28 ', then I send out the connection that is such ' firstname.lastname@example.org ', so that, as we modify it, the host is '% ', representing all the connection clients, this time, All we need to do is change the password.
However, when I was connected in my navicat, I found that I could not link, then I have to check to see if the password is wrong, we look at the user table again:
We can see that the password we modified above is localhost ' 123456 ' (here are all encrypted with MD5), but we use '% ', this time, found two passwords different, this time, we need to see what the password is, of course, I guess, Should be root, therefore, I put the navicat link password ' root ', found that can link up ...
There may also be problems with this:
This is the Telnet connection MySQL, there are garbled add h_mysql_native_passowrd problem, this time, do not care about it. It's not going to hurt.
When we are doing something, we need to think and learn, so that we can be more efficient!