Install Mysql_MySQL using the RPM Package

Source: Internet
Author: User
Install Mysql bitsCN.com using the RPM Package

Install Mysql using an RPM Package

As the company needs to install Mysql as the data server recently, the server version is redhat6. Find the Mysql RPM package on the redhat6 disc and directly use the RPM Package to install Mysql. during this period, you may encounter various problems.

The online introduction is basically the same. First install the server and then install the client. However, my server cannot be installed at all times.

Then follow the prompts to install the relevant package of perl-DBD-Mysql, or report an error. Later, I found that this package is mutually dependent on the mysql server package, so I changed the command for installing the server:

1. rpm-ivh mysql-server-5.1.47-4.el6.x86_64.rpm -- nodeps

Installed successfully

2. start mysql

/Etc/init. d/mysqld start

Unable to start, then follow the prompts to run the command

Chown-R mysql: mysql/var/lib/mysql

Restart successful

3. set the mysql root user password: mysqladmin-uroot password 'password'

4. logon test: mysql-u root-p

5. backup database: mysqldump -- add-drop-table -- opt test> backup-file. SQL

The following content is too lazy to be reproduced.

Mysql settings
1. password and login settings
We can use the command mysql_secure_installation to set the parameters.
Mysql_secure_installation

NOTE: running all parts of this script is recommended for all MySQL
Servers in production use! Please read each step carefully!

In order to log into MySQL to secure it, we'll need the current
Password for the root user. If you 've just installed MySQL, and
You haven't set the root password yet, the password will be blank,
So you shoshould just press enter here.

Enter current password for root (enter for none ):
Here, I have changed the default password Syntax by using the command mysqladmin:
Mysqladmin-uroot password 'newpassword'
Enter a new password.
[Root @ test-1 ~] # Mysql_secure_installation

NOTE: running all parts of this script is recommended for all MySQL
Servers in production use! Please read each step carefully!

In order to log into MySQL to secure it, we'll need the current
Password for the root user. If you 've just installed MySQL, and
You haven't set the root password yet, the password will be blank,
So you shoshould just press enter here.

Enter current password for root (enter for none ):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
Root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n '.

Change the root password? [Y/n] n
... Skipping.

By default, a MySQL installation has an anonymous user, allowing anyone
To log into MySQL without having to have a user account created
Them. This is intended only for testing, and to make the installation
Go a bit smoother. You shoshould remove them before moving into
Production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root shoshould only be allowed to connect from 'localhost'. This
Ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
Access. This is also intended only for testing, and shocould be removed
Before moving into a production environment.

Remove test database and access to it? [Y/n] n
... Skipping.

Reloading the privilege tables will ensure that all changes made so far
Will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done! If you 've completed all of the above steps, your MySQL
Installation shoshould now be secure.

Thanks for using MySQL!

We can follow the prompts to perform the operations step by step.
3.2. the default data file storage directory of MySQL is/var/lib/mysql. To move the directory to/home/data, perform the following steps:
1. create a data directory under the home directory
Cd/home
Mkdir data
2. stop the MySQL service process:
Mysqladmin-u root-p shutdown
3. move the entire/var/lib/mysql directory to/home/data
Mv/var/lib/mysql/home/data/
In this way, the MySQL data file is moved to/home/data/mysql.
4. find the my. cnf configuration file.
If my. for the cnf configuration file, go to/usr/share/mysql/and find *. copy one of the cnf files to/etc/and change it to my. cnf. The command is as follows:
[Root @ test1 mysql] # cp/usr/share/mysql/my-medium.cnf/etc/my. cnf
Note that there are four different mysql running configuration files under/usr/share/mysql:
My-large.cnf
My-medium.cnf
My-small.cnf
My-huge.cnf
5. edit the MySQL configuration file/etc/my. cnf.
To ensure that MySQL works properly, you must specify the location where the mysql. sock file is generated. Modify the value on the right of a socket =/var/lib/mysql. sock line with a moderate number
Is/home/mysql. sock. The procedure is as follows:
Vi my. cnf # Use the vi tool to edit the my. cnf file and find the following data to modify:
# The MySQL server
[Mysqld]
Port = 3306
# Socket =/var/lib/mysql. sock # original content. to be more secure, use "#" to comment this line
Socket =/home/data/mysql. sock # add this line
3.3 in order to log on to another computer as a root user, perform the following actions:
1. mark @ marklinux mark> mysql-h localhost-u root
// You can access the MySQL server.
2. mysql> grant all privileges on *. * TO 'root' @ '%' WITH GRANT OPTION
// Grant data access permissions to any host
Example:
Grant all privileges on *. * TO 'root' @ '1970. 16.0.10 'identified by 'skymobi' WITH GRANT
3.4 instructions:
3.4.1 default Mysql installation path
Find/-name mysql
/Usr/bin

BitsCN.com

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.