Follow-up operations on Mysql Server Installation

Source: Internet
Author: User
After installing mysql on the server, you generally need to do the following: 1. start mysqlserver2. set the root user and add some access users. 3. set User Permissions 4. configure non-local connection access 5. back up or migrate data 6. some precautions (continuously updated) 1. when mysqlserver is started

After installing mysql on the server, you generally need to do the following: 1. start mysql server 2. set the root user and add some access users. 3. set User Permissions 4. configure non-local connection access 5. back up or migrate data 6. some precautions (continuously updated) 1. usually

After installing mysql on the server, you generally need to do the following:

  • 1. Start mysql server
  • 2. Set the root user and add some Access Users
  • 3. Set User Permissions
  • 4. Configure non-local connection access
  • 5. Back up or migrate data
  • 6. Some precautions (Continuous updates)
1. Start mysql server

Generally, the following startup commands are used:

Service mysqld start

A common problem is:Timeout error occurred trying to start MySQL Daemon

The solution is also simple: simply execute

/Usr/bin/mysql_install_db

The directory may be different. The default installation is usually here.

View the service status of mysql:

/Etc/rc. d/init. d/mysqld status

2. Set the root user and add some Access Users

By default, the root account of mysql does not have a password after installation. Generally, a password is set for root to ensure security:

Mysql> update user set password = PASSWORD ('000000') where User = 'root ';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

3. Set User Permissions

Of course, mysql is provided to users and needs to be added to users:

Mysql> insert into mysql. user (Host, User, Password) values ('localhost', 'admin', password ("admin "));
Query OK, 1 row affected, 3 warnings (0.01 sec)
Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Now a new user admin/admin is added, but the user has not been assigned any permissions yet.

Mysql> grant ALL on *. * to admin @ "%" Identified by "admin ";
Query OK, 0 rows affected (0.00 sec)

% Represents any host. Of course, only select, insert, update, and delete operations can be granted:

Mysql> grant select, insert, update, delete on *. * to admin @ "%" Identified by "admin ";
Query OK, 0 rows affected (0.00 sec)
Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

4. Configure non-local connection access

By default, remote users are not allowed to access local databases. You need to execute commands to grant data access permissions to any host or related host:

Mysql> update user set host = '%' where user = 'admin ';

You can use the admin user to access data on any host.

Or:

Mysql> grant all privileges on *. * TO 'root' @ '%' WITH GRANT OPTION

5. Back up or migrate data

It is easier to use mysqldump. refer to the previous general article: Mysql Database Import and export.

6. Notes

In linux, the default mysql table name is case-sensitive. to rename a table that is case-insensitive, follow these steps.

  • 1. Log On with root and modify/etc/my. cnf
  • 2. Add a row under [mysqld]: lower_case_table_names = 1
  • 3. Restart the database.

~~ EOF ~~

Original article address: follow-up operations on Mysql Server Installation. Thanks to the original author for sharing.

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.