----------------------------装mysql
yum install mysql-server
----------------------------启动mysql
service mysql start
----------------------------进入mysql
mysql
-----------------------------设置数据库初始密码为111111
chkconfig mysqld on
mysqladmin -u root password 111111
--------------------------------------修改密码----
退出mysql执行
mysqladmin -uroot -p111111 password 123456
以上命令把刚刚设置的root用户的密码111111修改为123456
------------------------------mysql装好后,客户端连接需要做的设置
-------------------------让root可以远程访问
进入mysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '111111' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '111111' WITH GRANT OPTION;
#dev-ctc-vmanager 为计算机名
GRANT ALL PRIVILEGES ON *.* TO 'root'@'dev-ctc-vmanager' IDENTIFIED BY '111111' WITH GRANT OPTION;
FLUSH PRIVILEGES;
#GRANT ALL PRIVILEGES ON *.* TO 'iov_user'@'localhost' IDENTIFIED BY '1qaz2wsx' WITH GRANT OPTION;
#GRANT ALL PRIVILEGES ON *.* TO 'iov_user'@'%' IDENTIFIED BY '1qaz2wsx' WITH GRANT OPTION;
------------------修改/etc/my.cnf 配置: 修改默认字符集-------------------
[client]
default-character-set=utf8
[mysqld]
lower_case_table_names=1
default-character-set=utf8
character-set-server=utf8
default-storage-engine=InnoDB
------------------------------------
打开/etc/mysql/my.cnf
检查 bind-address 为
bind-address = 0.0.0.0
------------------修改MySql默认存储引擎为InnoDB
/etc/my.cnf中 [mysqld] 下增加 default-storage-engine=InnoDB
---------------------Linux修改MySql默认字符集
/etc/my.cnf中 [mysqld] 下增加
default-character-set=utf8
character-set-server=utf8
-----------------------------------------------
启动mysql
service mysqld start
关闭mysql
service mysqld stop
连接mysql(192.168.1.99)
mysql -u root -p 回车
输入密码 111111
-------------- 数据库操作
create database luhp;
use luhp;
如果想更改已经存在表和字符列的字符集,要用如下
mysql> alter table t2 convert to character set latin1;
--------------------------备份数据库
退出mysql执行
mysqldump -u root -p luhp > luhp.sql
提示输入密码,即吧luhp库备份到当前目录的luhp.sql文件中
-------------------------导入备份的数据
退出mysql执行
mysql -u root -p bak < luhp.sql
提示输入密码,把当前目录luhp.sql中的表结构导入到数据库bak中
================查询sql导入文件
mysql -h127.0.0.1 -uroot -p111111 -P3306 -e "select * from core.t_user where user_id in (select a1.user_id from core.t_user a1,core1.t_user a2 where a1.user_id = a2.user_id) and status =1 " > /home/lushang/trasformFromYd360/dup_compare/lushang_user_act.sql
导入的文件赋予全部权限