Link
Just another UMP Blog Sites site
Reference
Reference :
GCP
CREATE TABLE
instruction in your .sql file: USE your_database_name_here;
Reference :
wisercoder
Export
#mysqldump -u [username] -p [database name] > [database name].sql
Import
#CREATE DATABASE newdatabase;
Then log out of the MySQL shell and type the following on the command line:
#mysql -u [username] -p newdatabase < [database name].sql
Reference :
Digitalocean
version:
# mysql -V
Connect to the MySQL
# mysql -u root -p
If you haven’t already set up password for the MySQL root user, you can use the following command:
# mysql -u root
if you haven’t set up the MySQL root password yet , use the following command:
# mysql_secure_installation
To list all databases in MySQL, run the following command:
# mysql> show databases;
if you want to use a specific database and list all tables in it, , use the following command:
# mysql> use mysql;
To list the tables, you can use the command below:
# mysql> show tables
If you want to find out about the structure of a specific table you can use the DESCRIBE
statement in MySQL:
# mysql> DESCRIBE user;
Reference :
Rosehosting
# mysqladmin -u root -p status
Output (if yes):
"Enter password: Uptime: 4 Threads: 1 Questions: 62 Slow queries: 0 Opens: 51 Flush tables: 1 Open tables: 45 Queries per second avg: 15.500"
Output (Else)
"mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists! "
Under Debian Linux you can type following command to find out if MySQL server is running or not
# /etc/init.d/mysql status
If you are using RedHat of Fedora then you can use following script”
# service mysqld status
OR
# /etc/init.d/mysqld status
Reference :
Cyberciti
List running services using service command on a CentOS/RHEL 6.x or older
PRINT THE STATUS OF ANY SERVICE
service httpd status
LIST ALL KNOWN SERVICES (CONFIGURED VIA SYSV)
chkconfig –list s
LIST SERVICE AND THEIR OPEN PORTS
netstat -tulpn
Reference
cyberciti
SELECT * FROM mysql.user;
UPDATE mysql.user SET Password=PASSWORD('[password]') WHERE User='[username]';
But DO NOT FORGET to
when you are finished. Otherwise, your database’s security could be compromised.
Reference :
Stackoverflow
TechRepublic
Digitalocean
mysql -u root -p -h localhost
CREATE USER 'francesco'@'localhost' IDENTIFIED BY 'some_pass';
CREATE DATABASE shop;
GRANT ALL PRIVILEGES ON shop.* TO 'francesco'@'localhost';
quit;
mysql -u francesco -p -h localhost
source shop.sql;
$conn = new mysqli("localhost", "francesco", "some_pass", "shop");
Reference :
Stackoverflow
Stackoverflow [error 1045]