sudo apt-get install mysql-server
根用户登录
mysql -u root -p
指定用户名密码登录
mysql --user=user_name --password=your_password
CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'password';
CREATE USER 'user_name'@'%' IDENTIFIED BY 'password';
CREATE SCHEMA `database_name`;
USE `database_name`;
CREATE TABLE `table_name` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`username` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`createTime` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `index_username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4;
GRANT ALL PRIVILEGES ON `database_name`.* TO 'username'@'localhost';
修改MYSQL监听IP
[mysqld]
bind-address=192.168.0.200; # local IP Address
重启服务
sudo /etc/init.d/mysql restart
vim /var/log/mysql/error.log
CREATE TABLE `database`.`table` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ConnectionString: Server=;Database=;Uid=;Pwd=;Charset=utf8
解压二进制文件
bin\mysqld --initialize --console
mysql -u root -p
Enter password: (enter the random root password here)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
mysqld --console
mysqladmin -u root -p shutdown