MySQL-5.6.30-linux-glibc2.5-x86_64.tar.gz 安装教程

MySQL-5.6.30-linux-glibc2.5-x86_64.tar.gz 安装教程

一、安装

1、查看系统位数,首先查看系统是32位还是64位操作系统,然后下载相应的mysql版本。

# uname -a

2、创建mysql用户:

# useradd mysql

3、创建mysql用户组

# groupadd mysql

4、设置权限:

# cd /usr/local

# chown -R mysql:mysql mysql/

5、切换到mysql用户

# su - mysql

# cd /usr/local/mysql/scripts/

6、 安装:

# yum –y install perl perl-devel (可选,不存在则安装)

# cd /usr/local/mysql/scripts/

#./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

7、配置文件

# cp my-default.cnf /etc/my.cnf

二、启动Mysql

1、启动前配置

# chkconfig --add mysql

# chkconfig mysql on

# service mysql start

注意:运行“service mysql start”命令时如果发生:mysql is neither service nor target!? 这个错误,可以用下面两个命令进行解决

# systemctl unmask mysql.service

# service mysql start

2、设置root登录密码:

# /usr/local/mysql/bin/mysqladmin -u root password 'new-password'

3、配置远程登录

# mysql -uroot -p

​​Enter password: ​

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

Query OK, 0 rows affected (0.06 sec)

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.04 sec) ​


分享到:


相關文章: