mysql常用操作示例
1 下载安装包: sudo rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm 2 安装mysql: yum install mysql mysql-server mysql-libs mysql-server 3 启动mysql服务: service mysqld start 4 开机启动: chkconfig mysqld on 5.mysql登入 mysql -u root -p 6.登入后赋予外部ip访问权限 mysql>grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘; 7.刷新配置,立即生效 mysql>flush privileges; 8.外部导入sql文件 source /root/jxw.sql
示例sql文件:
drop database jxw; create database jxw; use jxw; SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for city -- ---------------------------- DROP TABLE IF EXISTS `city`; CREATE TABLE `city` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `state` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT=‘市级信息‘; -- ---------------------------- -- Records of city -- ---------------------------- BEGIN; INSERT INTO `city` VALUES (1, ‘石家庄‘, ‘河北‘); INSERT INTO `city` VALUES (2, ‘邯郸‘, ‘河北‘); COMMIT;
相关推荐
bleach00 2020-11-10
Coder技术文摘 2020-09-29
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11