阿里云服务器部署mysql

https://www.cnblogs.com/xxoome/p/5864912.html
https://www.cnblogs.com/fnlingnzb-learner/p/5830622.html

yum -y install perl perl-devel autoconf libaio
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
mv ./XX.gz /usr/local/
tar zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
cp mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql -r

groupadd mysql
useradd -r -g mysql -s /bin/false mysql
cd mysql/
chown -R mysql:mysql ./

./scripts/mysql_install_db --user=mysql
(可能:FATAL ERROR: please install the following Perl modules before executing scripts/mysql_install_db: Data::Dumper)
----yum install -y perl-Data-Dumper

chown -R root:root ./
chown -R mysql:mysql data

cp support-files/mysql.server /etc/init.d/mysql
# 赋予可执行权限
chmod +x /etc/init.d/mysql
# 添加服务
chkconfig --add mysql 
# 显示服务列表
chkconfig --list 

开启服务
service mysql start


导入sql文件
1、首先建空数据库
mysql>create database abc;

2、导入数据库
方法一:
(1)选择数据库
mysql>use abc;2)设置数据库编码
mysql>set names utf8;3)导入数据(注意sql文件的路径)
mysql>source /home/abc/abc.sql;

sql文件上传(sftp)
sftp tecmint@192.168.56.10
put -r abc.sql

猜你喜欢

转载自blog.csdn.net/weixin_40632321/article/details/84928275