安装mysql
yum install mysql-server
启动mysqlservice mysqld start
停止mysqlservice mysqld stop
重启mysqlservice mysqld restart
-
配置mysql
- 修改root密码
/usr/bin/mysqladmin -u root password 'new password'
- 修改字符编码
vim /etc/my.cnf
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
[mysql]
default-character-set=utf8 - 修改使其不区分表名大小写(注意在[mysqld]添加])
lower_case_table_names=1
- 配置远程访问(任何主机通过root访问)
登入到mysql再执行以下命令grant all on *.* to root@'%' identified by 'root-password'
flush privileges
别忘记重启mysql
- 修改root密码
- 移动数据库
mysqldump -u root -p --database databaseName |mysql -h 118.89.165.181 -u root -p
- 更改root密码
my.cnf的[mysqld]加入skip-grant-tables
(跳过验证)update user set password=password('zycx') where user = 'root'
或则update user set authentication_string=password('zycx')where user = 'root' (mysql5.7)
flush privileges
my.cnf中去除skip-grant-tables
这句