mysql安装启动以及配置
使用到阿里云主机直接yum安装以及配置
[root@yunwei-169 mysql]# yum install mysql mysql-server [root@yunwei-169 mysql]# mysql -V mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1 [root@yunwei-169 mysql]# 安装这版本默认没有密码直接启动服务,创建abc用户,赋予所有库和表到权限 [root@yunwei-169 mysql]# /etc/init.d/mysqld start [root@yunwei-169 mysql]# mysql -h 127.0.0.1 -uroot mysql> update mysql.user set password=PASSWORD("youpassword") where user="root"; mysql> select user,host,password from mysql.user; +-------+------------+-------------------------------------------+ | user | host | password | +-------+------------+-------------------------------------------+ | root | localhost | *011BD6B76D153FF40E1B332A525F208A510B4297 | | root | yunwei-169 | *011BD6B76D153FF40E1B332A525F208A510B4297 | | root | 127.0.0.1 | *011BD6B76D153FF40E1B332A525F208A510B4297 | | | localhost | | | | yunwei-169 | | +-------+------------+-------------------------------------------+ 6 rows in set (0.00 sec) mysql> create user 'abc'@'%' IDENTIFIED BY 'password'; mysql> grant all privileges on *.* to 'abc'@'%'; #给予操作权限
mysql>flush privileges; #刷新权限使其生效
本地业务迁移前数据库是通过mysqldump –all-databases -h127.0.0.1 -uroot -pxxxxx> xxx.sql 的方式备份的数据
然后数据库创建导入
[mysql]> create database abc; [mysql]>use adb; [mysql]>set names utf8; [mysql]>source /xxx.sql;
给新的web后台和本地维护添加权限
导入方式2:
mysql -h127.0.0.1 -uxxx -pxxx tablename </tmp/aaa.sql &