解决mysql中文乱码问题
1、打开文本编辑my.cnf
sudo gedit /etc/mysql/my.cnf
在[client]
节点,添加
default-character-set=utf8 (客户端缺省以utf8存储)
在[mysqld]
节点,添加
default-character-set=utf8 (数据库缺省以utf8存储)
init_connect='SET NAMES utf8'
(设定连接mysql数据库时使用utf8编码,以让mysql数据库为utf8运行)
保存,关闭
2、重启mysql
停用:
sudo mysqladmin shutdown -u root -p
启用:
sudo mysqld_safe -user=mysql &
3、查看mysql编码
sudo mysql -u root -p
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 &nb
相关文档:
个人劳动,还请尊重,如若转载请注明出处。iihero@CSDN
看到有些朋友老问这个非安装版与安装版有什么区别(当然是windows平台)
干脆写了一个脚本自动为其创建mysql5服务。
脚本如下,将其放到解压以后的目录里边执行即可。
@echo off
echo "This is a demo script for auto installation of noninstall version o ......
/**********************by garcon1986***************************************/
错误代码如下:
#1045 - Access denied for user 'root'@'localhost' (using password: YES)
$cd /etc/mysql
$mysql -u root -p
出现错误#1045
尝试了很多方法后,在网络上找到了解决方法。
$cd /etc/mysql
$gedit debian.cnf
找到 ......
1.建表过程如下
create database test default character set utf8 collate utf8_general_ci
use test;
create table devicedata
(
ID int auto_increment PRIMARY key ,
TimeStamp datetime,
Device_Name varchar(100),
Tag_Name varchar(100),
Value varchar(50)
)
2 ......
CREATE PROCEDURE pro_page(
in _sql varchar(1000),
in _order varchar(1000),
in _pagecurrent int,
in _pagesize int
)
BEGIN
if _pagesize<=1 then
set _pagesize=20;
end if;
if _pagecurrent < 1 then
set _pagecurrent = 1;
&n ......