yum list installed mysql*
rpm -qa | grep mysql*
yum list mysql*
yum install mysql
yum install mysql-server
yum install mysql-devel
mysql配置文件/etc/my.cnf中加入default-character-set=utf8
可以使用如下命令查看mysql全局编码格式
mysql> SHOW VARIABLES LIKE 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (2.05 sec)
mysql> SHOW VARIABLES LIKE 'collation%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.43 sec)
如果没有成功将编码转成utf-8,也可以使用如下命令进行转.
mysql> SET character_set_client = utf8 ;
mysql> SET character_set_connection = utf8 ;
mysql> SET character_set_database = utf8 ;
mysql> SET character_set_results = utf8 ;
mysql> SET character_set_server = utf8 ;
mysql> SET collation_connection = utf8_general_ci ;
mysql> SET collation_database = utf8_general_ci ;
mysql> SET collation_server = utf8_general_ci ;
service mysqld start或者/etc/init.d/mysqld start
service mysqld stop
chkconfig --add mysqld
检查是否成功配置开机启动使用如下命令
chkconfig --list | grep mysql*
mysqld 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
mysql -u root -p
初始默认root无密码
service mysqld stop
mysqld_safe --user=root --skip-grant-tables
mysql -u root
mysql>use mysql
mysql>update user set password=password("new_pass") where user="root";
mysql>flush privileges;
开放防火墙的端口号,默认端口是3306
mysql增加权限:mysql库中的user表新增一条记录host为"%",user为"root".
GRANT ALL PRIVILEGES ON * . * TO 'root'@'%' IDENTIFIED BY 'qyf404' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 ;
数据库目录 /var/lib/mysql/
配置文件 /usr/share /mysql(mysql.server命令及配置文件)
相关命令 /usr/bin(mysqladmin mysqldump等命令)
启动脚本 /etc/rc.d/init.d/(启动脚本文件mysql的目录)