Yum installs MySQL automatically

Source: Internet
Author: User
Tags mysql client mysql in

1. Install client and server side
View CentOS comes with MySQL:
Yum List Installed | grep MySQL
Uninstalling the CentOS system with the MySQL database?
Yum-y Remove mysql-libs.x86_64
Install the MySQL client and server:
Yum-y install mysql-server MySQL mysql-devel
When the results are displayed as "complete! The installation is complete.
Review the MySQL database version information you just installed.
Rpm-qi Mysql-server
The information is as follows:
Name:mysql-server Relocations: (not relocatable)
version:5.1.73 Vendor:centos

2. Start and stop settings

Database Character Set settings
MySQL config file/etc/my.cnf added
[Client]
Default-character-set=utf8


To start the MySQL service:
Service mysqld Start
or/etc/init.d/mysqld start.
Add MySQL to the service list
Chkconfig--add mysqld
Set boot up:
Chkconfig mysqld on
See if the boot setting is successful
Chkconfig--list | grep mysql*
Mysqld 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: Off

3, login and forget to change the password

MySQL in Linux system create root user

Phenomenon:
[Email protected]:/usr/share/mysql# mysql-uroot-p
Enter Password:
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)
[Email protected]:/usr/share/mysql# mysql-uroot-p
Enter Password:
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)

Workaround:

1. Enter/etc/my.cnf and add in the [mysqld] section: skip-grant-table

2. After restarting the MySQL service (or restarting the machine), you can enter MySQL without a password


3.INSERT into user VALUES ('% ', ' root ', PASSWORD (' Sinoway123 '), ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' Y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y, ' y ', ', ', ', ', ', ', 0,0,0,0 ';

Note: Error may occur when an insert is executed

This time you need to compare the columns in the USR table with the columns of the insert

You need to change the number of "Y" inserted according to the columns in the USR table.

Login:
Mysql-u root-p


If you forget your password,
Stop the MySQL service first:
Service Mysqld Stop
Then execute the following code
Mysqld_safe--user=root--skip-grant-tables
Mysql-u Root
Use MySQL;
Update user set Password=password ("Sinoway123") where user= "root";
Refresh the MySQL system permissions related table
Flush privileges;
To start the MySQL service:
Service mysqld Start

4. Allow Remote access settings

Port number for open firewall
MySQL Add permission: The user table in the MySQL library has a new record of "%" and the user is "root".
Direct input
Mysql
And then
Use MySQL;
Update user Set host = '% ' where user = ' root ' LIMIT 1;

% means all IP access is allowed


5. Several important directories of MySQL

(a) Database directory
/var/lib/mysql/
(b) configuration files
/usr/share/mysql (mysql.server command and configuration file)
(c) Related orders
/usr/bin (Mysqladmin mysqldump and other commands)
(d) Startup scripts
/etc/rc.d/init.d/(startup script file for MySQL directory)

Yum installs MySQL automatically

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.