MySQL user creation and authorization environment www.2cto.com MySQL 5.1 + command line tool problem MySQL user creation and authorization solution 1. log on as the root USER to CREATE a new USER [SQL] C: \ Users \ Wentasy> mysql-uroot-p mysql> CREATE USER music IDENTIFIED BY 'music'; 2. log on as the root user to create a database [SQL] create database music default charset utf8; create table tb_user (tb_user_id int (11) primary key auto_increment, tb_user_account varchar (32) not null, tb_user_password varchar (16) not null, tb_user_nick varchar (16) not null, tb_user_name varchar (32) not null, tb_user_gender bit (1), tb_user_phone varchar (16 ), tb_user_email varchar (40), check (tb_user_gender in ('0', '1'); create table tb_playlist (tb_playlist_id int (11) primary key auto_increment, tb_user_id int (11) not null, tb_playlist_title varchar (255) not null, constraint statement foreign key (tb_user_id) references tb_user (tb_user_id); create table tb_records (occurrence int (11) primary key auto_increment, tb_playlist_id int (11) not null, tb_records_name varchar (40) not null, constraint FK_TB_PLAYLIST_ID foreign key (tb_playlist_id) references tb_playlist (tb_playlist_id); 3. GRANT [SQL] mysql> GRANT ALL PRIVILEGES ON music. * TO music @ localhost identified by 'music'; 4. log on to the [SQL] C: \ Users \ Wentasy> mysql-umusic-p Enter password: * *** Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 6 Server version: 5.1.43-community MySQL Community Server (GPL) Type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement. mysql> show databases; + -------------------- + | Database | + -------------------- + | information_schema | music | + ------------------ + 2 rows in set (0.00 sec) mysql> use music; database changed mysql> show tables; + ----------------- + | Tables_in_music | + videos + | tb_playlist | tb_records | tb_user | + --------------- + 3 rows in set (0.01 sec) mysql>