MySQL

Install on Windows

Create a my.ini file in the C:\Windows directory

[mysqld]

  1. set basedir to your installation path

basedir=C:/DevApps/MySQL/8.0.18

  1. set datadir to the location of your data directory

datadir=C:/DevApps/MySQL/8.0.18/data

run mysqld.exe --initialize

In the data directory there is a log file that contains a temporary password for root.

I found it here: DL54-4S1FP13.err

Use Workbench, log in as root with the temporary password.

It will force you to create a new password for root.

Exit Workbench. Restart Workbench


Linux

Change root password.

sudo mkdir -p /var/run/mysqld

sudo chown mysql:mysql /var/run/mysqld

sudo mysqld_safe --skip-grant-tables &

mysql

mysql> use mysql;

update user set authentication_string=PASSWORD("YourPassword") where User='root';

update user set plugin="mysql_native_password" where User='root';

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;


Linux load timezone tables

./mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

Java info

<code>
	@Bean
	public DataSource dataSource() {
		DriverManagerDataSource dataSource = new DriverManagerDataSource();

		// dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
		dataSource.setDriverClassName("com.mysql.jdbc.Driver");
		dataSource.setUsername("auth_user");

		dataSource.setPassword("ChangeIt");
		
		// dataSource.setUrl("jdbc:mysql://localhost:3306/auth?createDatabaseIfNotExist=true");
		dataSource.setUrl("jdbc:mysql://localhost:3306/auth?createDatabaseIfNotExist=true&serverTimezone=UTC&useLegacyDatetimeCode=false");

		return dataSource;
	}

</code>