Linux installation MySQL

Source: Internet
Author: User
Tags install perl

1. Download

: Http://dev.mysql.com/downloads/mysql/5.6.html#downloads

Download version: I choose here 5.6.33, General edition, Linux under 64-bit

You can also directly copy the 64-bit, download by command: wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz

2. Decompression

1234 #解压tar-zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz#复制解压后的mysql目录cp-r mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql

3. Adding user groups and users

1234 #添加用户组groupadd mysql#添加用户mysql 到用户组mysqluseradd-g mysql mysql

4. Installation

123456789101112131415161718192021222324252627282930 cd/usr/local/mysql/mkdir./data/mysqlchown-R mysql:mysql ././scripts/mysql_install_db--user=mysql --datadir=/usr/local/mysql/data/mysqlcpsupport-files/mysql.server /etc/init.d/mysqldchmod755 /etc/init.d/mysqldcpsupport-files/my-default.cnf /etc/my.cnf#修改启动脚本vi/etc/init.d/mysqld#修改项:basedir=/usr/local/mysql/datadir=/usr/local/mysql/data/mysql #启动服务service mysqld start#测试连接./mysql/bin/mysql-uroot#加入环境变量,编辑 /etc/profile,这样可以在任何地方用mysql命令了exportPATH=$PATH:/usr/local/mysql/bin
#启动mysqlservice mysqld start#关闭mysqlservice mysqld stop#查看运行状态service mysqld status

5. Error

5.1 SQLyog 1130 error when connecting, due to no user rights issue for remote connection

Resolution 1: Change the ' MySQL ' database ' user ' table ' host ' entry from ' localhost ' to '% '.

Resolution 2: Direct authorization

  

GRANT all privileges on * * to ' root ' @'% ' identified by ' Youpassword ' with GRANT OPTION;

5.2 Some errors during installation

   

-bash:./scripts/mysql_install_db:/usr/bin/-y install perl perl-devel installing MySQL system tables....< /c1> while loading shared libraries:libaio.so. 1 object file:no such file or directory

   

Solution: Yum-y Install Libaio-devel

  

6. Other

6.1 Configuring Environment variables

   

VI +/etc/profileexport PATH=....:/usr/local/mysql/bin

7 MySQL Open service self-booting

Command echo "service mysqld start" >>/etc/rc.local

Or go to/etc/directory, direct vim rc.local edit rc.local file, add "service mysqld start" in the last line, save exit

8 MySQL init password

Because MySQL just installed is no password, so we have to set it password

⑴, just installed, the root user is empty, need to change the password: ①mysqladmin-U root password 'New-password ' ② or, after landing, directly modify the password in the user's table MySQL-u root #用root用户登录1.SelectUser,host,password fromMysql.user; Users viewing the database2. Use MySQL #切换到mysql表SetPassword for[Email Protected]=password ('123456'); #设置指定域名下root账号的密码SetPassword for[Email protected] Domain name =password ('123456'); 3. Or, more common SQL operations: Update userSetPassword=password ('123456')whereUser=' [email protected] '; ⑵, anonymous user is dangerous delete fromMysql.userwhereUser="'; #删除匿名用户 ⑶, Exit Mysql:exit;

Test

[Email protected] ~]mysql-~]mysql-u root-123456 #显示密码登陆

9 Setting up native remote access to the remote server's MySQL

NAVICAT permissions issues for remote connections

A remote login will appear with the following prompt:
1103-host xxx.xxx.xxx.xx is not allowed to Connec to this MySQL server. Or 1045-access denied for user ' root ' @ ' 192.168.1. One ' (using Password:yes).

Solution:

MySQL Access grant all privileges on * * to ' root ' @ '% ' identified by ' 123456 '; #其实就是权限问题, set ROOT to assign all permissions when all domains (% means any address) are logged in Password 123456. You can set it more strictly as needed.

The above 123456 is the password you set yourself, the remote password should be strict, otherwise it will not be malicious breach

Linux installation MySQL

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.