Linux安装mysql(Ubuntu)

一、安装

apt-get update
apt-get install mysql-server
sudo apt-get install mysql-client
apt-get install libmysqlclient-dev

二、配置

#连接mysql

mysql -u root -p

2.1.建库授权

create database jz default character set utf8 collate utf8_general_ci;

create user 'admin'@'%' identified by 'root';

grant all privileges on *.* to admin;

grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;

grant all privileges on *.* to 'admin'@'%' identified by 'root' with grant option;
 
 
FLUSH PRIVILEGES;

2.2.配置文件

cat /etc/mysql/mysql.conf.d/mysqld.cnf

bind-address = 0.0.0.0
lower_case_tables_name = 1

#停止
/etc/init.d/mysql stop

#启动
/etc/init.d/mysql start

netstat -nltp  | grep 3306 

你可能感兴趣的:(Linux安装mysql(Ubuntu))