Install MySQL under Linux using the Yum command

Source: Internet
Author: User
Tags mysql client

Install MySQL with Yum under Linux, and start, log in, and remotely access the MySQL database. 1. Yum install MySQL

1. Check that there are no installation packages:
Yum List mysql*
#移除已经安装的mysql
Yum remove MySQL mysql-server mysql-libs compat-mysql51
Rm-rf/var/lib/mysql
Rm/etc/my.cnf
2. Check to see if you have MySQL software:
Rpm-qa|grep MySQL
#如果有的话, continue to delete
3. Install MySQL

To install the MySQL client:

Yum install MySQL

To install the MySQL server side:

Yum Install Mysql-server

Yum Install Mysql-devel

2. Start && Stop Database

1. Enter the MySQL configuration file and set the CharSet:
> vi/etc/my.cnf
# Add configuration Parameters
> Default-character-set-server=utf8
2. Start the MySQL service
> Service mysqld Start
#或者下面这个
>/etc/init.d/mysqld start
3. Set Boot up
>chkconfig--add mysqld
>chkconfig mysqld on
4. Check if the boot startup settings are successful
>chkconfig--list | grep mysql*
# mysqld 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: Off stop

3. Log in to MySQL

1. #创建root管理员:

>mysqladmin-u Root password Password

2. Login

>mysql-u root-p

>enter Password: Enter password
#如果忘记密码解决, review the following questions

3. Forgot password

>service mysqld Stop

>mysqld_safe--user=root--skip-grant-tables

>mysql-u Root

>use MySQL

>update User Set Password=password ("New_pass") where user= "root";

>flush privileges;

4. Remote access to the port number of the open firewall MySQL

Note: The following two steps need to be performed. Step one, just modify the user's password. However, the user is not authorized; Step two is authorization, allowing the user to specify permissions (connect to database, query database ...)
1. Change the table method. It may be that your account is not allowed to log on remotely, only on localhost. This time, as long as the computer on the localhost, log in to MySQL, change the "MySQL" Database in the "User" table "host", from "localhost" to "%"
Mysql-u Root-pvmware;
Mysql>use MySQL;
Mysql>update User Set host = '% ' where user = ' root ';
Mysql>select host, user from user;
2. Authorization law. For example, if you want to myuser use MyPassword to connect to a MySQL server from any host.
GRANT all privileges on * * to ' myuser ' @ ' percent ' identified by ' MyPassword ' with GRANT OPTION;
If you want to allow users to connect to the MySQL server from a host myuser IP 192.168.1.3 and use MyPassword as the password
GRANT all privileges on * * to ' myuser ' @ ' 192.168.1.3 ' identified by ' MyPassword ' with GRANT OPTION;

Install MySQL under Linux using the Yum command

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.