MySQL environment setup under Linux (CentOS)

Source: Internet
Author: User
Tags mysql in

Baidu search MySQL, into the https://dev.mysql.com/downloads/mysql/to find their own version of the MySQL Linux compression package;

Copy out the compressed package ( Click Download First, and then copy the resource link from the download interface )

Create a MySQL directory in a suitable location on the server (personal habits/usr/local)

wget+ copy of the JDK download link, download the MySQL compressed file to the directory you created

TAR-ZXVF filename Decompression

File Rename with mv+ original filename + new file name

Add MySQL Combo MySQL account (security issue: Prevent all accounts that affect the entire system because of database account problems)

Groupadd MySQL

Useradd-r-G mysql-s/bin/false MySQL

Go to MySQL directory, modify all filegroups and accounts for MySQL in this directory

CD MySQL

Chown-r Mysql:mysql./

Installing the Database

./scripts/mysql_install_db--user=mysql

Modify all file groups and accounts in the directory except for the Root,data directory

Chown-r Root:root./

Chown-r Mysql:mysql Data

Add Boot: Execute command CP Support-files/mysql.server/etc/init.d/mysql, put startup script into boot initialization directory

Add Service

Chkconfig--add MySQL

Show List of services

Chkconfig--list

Start MySQL service: Execute command service MySQL start

The MySQL executable file is soft-chained to the execution bin

Ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql

MySQL is already installed and MySQL does not have a password by default and any user can log in (mysql-u any user name)

If login error at this time:Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2), Use the Find command to find if Mysql.sock is present and if the path is/tmp/mysql.sock

[Email protected] mysql]# Find/-name Mysql.sock
/var/lib/mysql/mysql.sock

be installed to/var/lib/mysql/mysql.sock this location, we need to modify the My.cnf file (vi/etc/my.cnf)

Restart MySQL service after saving

Remove any user login rights after logging in to MySQL

Delete from Mysql.user where user= "";

Set the root user password

Update Mysql.user set Password=passworf ("password") where user= "root";

Flush privileges;

Use password mysql-uroot-p password to re-use root login after exiting

MySQL environment setup under Linux (CentOS)

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.