mysql+linux安装

阅读更多

 

mysql-5.6.41-linux-glibc2.12-x86_64.tar.gz

 

tar -xzvf mysql

 

mv mysql /usr/local/mysql

 

cd mysql

 

groupadd mysql

useradd -r -g mysql -s /bin/false mysql

 

chown -R mysql:mysql mysql

 

chmod 750 mysql

 

yum -y install autoconf 

yum install libaio

 

 

cd mysql

 

./scripts/mysql_install_db --user=mysql

 

bin/mysqld --initialize --user=mysql 

bin/mysqld_safe --user=mysql &

 

chown -R root:root ./

 

cp support-files/mysql.server /etc/init.d/mysql

 

chmod +x /etc/init.d/mysql

 

更改 /usr/local/mysql/my.cnf 和 /etc/my.cnf

 --------------------------------

[mysqld_safe]

#log-error=/var/log/mariadb/mariadb.log

#pid-file=/var/run/mariadb/mariadb.pid

 

log-error=/usr/local/mysql/mysqld_safe/mariadb.log

pid-file=/usr/local/mysql/mysqld_safe/mariadb.pid

 --------------------------------------------------

必须创建/usr/local/mysql/mysqld_safe/mariadb.log

 

service mysql start

service mysql restart

service mysql stop

 

--------------------------

 

service mysql status

yum install lsof

lsof -i:3306

 

ln -s /usr/local/mysql/bin/mysql /usr/bin

 

mysql -h localhost -u root -p

123456

 

 

show databases;

 

iptables -A INPUT -ptcp --dport  3306 -j ACCEPT

 

远程访问:所有主机均可密码访问,如果需要本机localhost访问,需要通过navicat复制一条刚才的数据,insert进去,把修改后的数据%再换成localhost

mysql -u root -p

use mysql;

update user set host = '%' where user = 'root'  and host='localhost';

select host,user from user;

 

重启mysql,service mysql stop,service mysql start

service mysql restart

 

 

yum install -y unzip zip

 

 

https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html

 

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql 
shell> bin/mysql_ssl_rsa_setup              
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

 

你可能感兴趣的:(mysql+linux安装)