"mysql" and "test" instances are set up the first time you run /etc/init.d/mysql. (Displays commands to run to set root password.) For installation, see my file "sql/setup.d/mariadb_mysql.sql". mysql has poor schema support. SQL "databases" are basically schemas. You set your default schema with "use" or \u, and you can override this like "SELECT * from dbname.tablename;" Also no roles, no sequences. There are autoincrementers, but they are persisted only as column attributes. The "mysql" database is the system schema. Contains Connection privs are shown in mysql.user (I think) Other privs are shown in mysql.db (I think) VERY FEW SYSTEM TABLES! /etc/init.d/mysql runs safe_mysql. Switches DB instance: USE dbname "mysqladmin" can be used for most admin stuff, like changing passwords and making accounts. Run mysql (the native client): mysql -uroot -pmypassword [dbname] Critical command to know is "show". To list available databases $ ls /var/lib/mysql mysql> SHOW databases show tables [from mysql]; # Shows only tables in current database/schema. show databases; help show; Default network port is 3306. CREATING USERS: mysql> GRANT ALL PRIVILEGES ON *.* TO monty@localhost -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION; mysql> GRANT ALL PRIVILEGES ON *.* TO monty@'%' -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION; To remove a user: DELETE FROM mysql.user WHERE user = 'x'; List users: SELECT host, user FROM mysql.user; ########### The '%' command is letting me in with blank password with other host names. The one for localhost works fine. I can only get in with localhost for new accounts. Accounts are distinguished by remotehost + local user. DUMB. What if george connects from 8 different remote hosts? Manual says that you can't grant create/drop table privs without giving DB create/drop privs. ???? mysql> FLUSH PRIVILEGES; (*.* is dbname.objectname). OR "mysqladmin -uroot -ppassword reload". Have to create 2 accounts for every user! user@localhost and user@'%'! Flush is required to "activate" the priv table changes before a server restart. [At least with mariadb and JDBC, I do not have to flush a GRANT SHOW VIEW ON dbname.* TO...; Can add privs to other databases with GRANT ALL PRIVILEGES ON otherdb.* TO monty@'%' Sun Mar 1 18:15:05 EST 2009 UPDATE. It looks like they have fixed things so that you can now simply GRANT ALL PRIVILEGES ON *.* TO tom IDENTIFIED...; This will write host value of "%" which now actually works correctly. PRIVILEGES x.* in grant specifications DOES NOT MEAN all objects now qualifying-- it really means all of x, i.e. everything within x now and in future. Consequently x.* grants correspond directly to rows in table mysql.db. Host name resolution works TERRIBLY!!!! "select current_user()" shows the rule that let you in. Very useful. "select user()" shows the authorized host (which will work in rules for you!) "Password: NO" in error messages means that no password was given. Relatedly, there is no 'public' role and no general way to grant a privilege to everybody. For SOME subcases like all privs, apparently can sometimes work like this, but fails for me: grant select on tablename to ''@'localhost' https://stackoverflow.com/questions/23815765/how-to-grant-select-on-tablename-to-public-in-mysql By default an account gets the useless 'USAGE' privilege, as shown by: show grants for 'blaine'; Viewing grants: SHOW grants for 'x'; and tables mysql.db and information_schema.table_privileges GOTCHA! Can't "use" a database unless account has any global or database-level privilege. HACK: grant show view on db2 to 'blaine'; Password change: SET PASSWORD FOR 'mynewuser'@'localhost' = PASSWORD('newpwd'); JDBC Jar file: mysql-connector-java*.jar Driver class com.mysql.jdbc.Driver URL jdbc:mysql:/// Defaults to localhost port 3306 and connects to NO db. More generally jdbc:mysql://hostname:1234[/dbname] (port defaults to 3306). /dbname specifies default database for commands (equiv or similar to "use") (otherwise must qualify object specifications). JDBC does not differentiate system vs. regular tables. (Really needs this since there is no feature corresponding to the mysql command line "show" command).