Home > Database > Mysql Tutorial > Ubuntu下安装Mysql

Ubuntu下安装Mysql

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:18:36
Original
1277 people have browsed it

一,打开终端,在线安装 sudo apt-get install mysql-server 安装 期间 会提示你输入root账户的密码。 二,验证是否安装成功 终端里输入: mysql -uroot -p //根据提示输入密码 showdatabases; //显示所有数据库 三,配置MySQL默认字符集为UTF-8 打开MySQL服

一,打开终端,在线安装

sudo apt-get install mysql-server
Copy after login
Ubuntu下安装Mysql

安装期间会提示你输入root账户的密码。

二,验证是否安装成功

终端里输入:

mysql -uroot -p  //根据提示输入密码
Copy after login
showdatabases;  //显示所有数据库
Copy after login

三,配置MySQL默认字符集为UTF-8

打开MySQL服务器的配置文件my.cnf

sudo gedit /etc/mysql/my.cnf
Copy after login


增加客户端的字符编码:找到[client]

default-character-set=utf8
Copy after login

增加服务端的字符编码:找到[mysqld]

character-set-server=utf8
collation-server=utf8_general_ci
Copy after login

修改之后保存,退出。打开终端,重启MySQL服务。

sudo /etc/init.d/mysql restart
Copy after login


登陆MySQL,查看字符编码。

show variables like '%char%';
Copy after login

看到下图说明修改字符编码成功。

Ubuntu下安装Mysql

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template