Search
 
SCRIPT & CODE EXAMPLE
 

SQL

how to install mysql ubuntu

sudo apt update
sudo apt install mysql-server
sudo service mysql start
sudo mysql_secure_installation
sudo mysql -u root 

In mysql console:
DROP USER 'root'@'localhost';
CREATE USER 'root'@'%' IDENTIFIED BY 'YOURPASSWORD';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Comment

install MySQL in ubuntu

# Installing MySQL
sudo apt update
sudo apt install mysql-server

# — Configuring MySQL
sudo mysql_secure_installation
|-----> # Creating a Dedicated MySQL User and Granting Privileges
|		sudo mysql, mysql -u root -p,sudo mysql --defaults-file=/etc/mysql/debian.cnf
|		CREATE USER 'user'@'localhost' IDENTIFIED BY 'user1122';
|		# Change User Password
|		ALTER USER 'user_name'@'localhost' IDENTIFIED BY 'newPassword';
|		FLUSH PRIVILEGES;
|		# IF ERROR 1819 (HY000): Your password does not satisfy
|		# The current policy requirements (Source: ostechnix.com)
|		SET GLOBAL validate_password.policy = 0;
|		SET GLOBAL validate_password.length = 6; # If Required.
|		SET GLOBAL validate_password.number_count = 0; # If Required.
|		SHOW VARIABLES LIKE 'validate_password%'; # Show password level.
|
|		# Granting privileges
|		GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';
|		SHOW GRANTS FOR 'user'@'localhost';
|		FLUSH PRIVILEGES;
|		
|		# Delete User
|		DROP USER 'user'@'localhost';
|		# Show All Users
|		SELECT User, Host FROM mysql.user;
|		
|-----> # Creating database
|		create database db_name;
|		# Show DataBase
|		SHOW DATABASES;
|		# Delete Database
|		DROP DATABASE db_name;
|-----> # Creating table
|		USE db_name;
|		CREATE TABLE t_name (id int, name varchar(100));
|		# Insert Data
|		INSERT INTO t_name VALUES (1, 'AliRaza');
|		# Delete Table
|		DROP TABLE t_name;
|		# Show All tabales in DB
|		USE db_name;
|		SHOW TABLES;
|
|-----> # Import Sql File
|		mysql -u username -p db_name < file.sql
|
|-----> # Export Sql Database
|		mysqldump -u username -p db_name > file.sql
Comment

install mysql on ubuntu

sudo apt-get update
sudo apt-get install mysql-server
Comment

ubuntu mysql install and configure

GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD ON *.* TO 'mysqluser'@'localhost' WITH GRANT OPTION;
Comment

PREVIOUS NEXT
Code Example
Sql :: datatables server side filter where clause 
Sql :: ranking functions in sql 
Sql :: SQL Using Prepared Statements 
Sql :: timestamp type in sql 
Sql :: migrations.RunSQL 
Sql :: sqlite csv 
Sql :: mysql create trigger 
Sql :: not in sql 
Sql :: mysql procedure 
Sql :: postgres add foreign key to existing table 
Sql :: constraint sql 
Sql :: ring MySQL commit updates to the database 
Sql :: mariadb errno 121 
Sql :: query to generate query to drop primary keys or foreign key in ms sql server 
Sql :: decode plsql 
Sql :: mysql create index lost connection 
Sql :: allow all local clients (local socket connections) to connect to the kodekloud_db1 
Sql :: sql developer sql worksheet not showing 
Sql :: Priviledges on table from other schema 
Sql :: mysql find char in string 
Sql :: value of sold product using having and group by in sql 
Sql :: convert sql to linq online converter 
Sql :: QUERY JPQL 
Sql :: mysql installer no packages found 
Sql :: CREATE MULTIPLE FK 
Sql :: What is the library that should import to use all functional database features in SQLite? 
Sql :: oracle database table to check invalid login attempts 
Sql :: how we can perform acid Operations in sql with examples 
Sql :: low level operator in dbms 
Sql :: Sauvegarde complète my sql 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =