sudo apt-get install mysql-server mysql-client libmysqlclient-dev libmysqlclient18 libmysql++-dev libmysql++3 libmysql++-doc
登录mysql后台
mysql -uroot -p导入数据库
mysql -uroot -p < northwind.sql产生一个新的用户给一个数据库
grant all on Northwind.* to roger@localhost identified by 'intel@123';剔除某个用户的权利,但是不删除那个用户在user表的信息
revoke all on Northwind.* from roger@localhost;删除用户
delete from user where user = 'roger';
用C语言连接MySQL数据库包含两个步骤:
初始化一个连接句柄结构(mysql_init)
MYSQL * STDCALL mysql_init(MYSQL *mysql);
实际进行连接(mysql_real_connect)
MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag);